summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarnie McCormack <marnie@apache.org>2011-02-23 11:47:21 +0000
committerMarnie McCormack <marnie@apache.org>2011-02-23 11:47:21 +0000
commit052e0384661c654f6067f21cb55254eb46885127 (patch)
treee63e2862c9bfa7a5c7d7bf760c38765b3d82ed57
parentf96eb3b2e68f6067915a0774f9e055239dbde723 (diff)
downloadqpid-python-052e0384661c654f6067f21cb55254eb46885127.tar.gz
QPID-3062 new examples for 0-8 dotnet client
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1073704 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/dotnet/Consumer/Program.cs30
-rw-r--r--qpid/dotnet/Consumer/default.build47
-rw-r--r--qpid/dotnet/Producer/Program.cs30
-rw-r--r--qpid/dotnet/Producer/default.build47
-rw-r--r--qpid/dotnet/Program.cs30
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs56
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs55
-rw-r--r--qpid/dotnet/README.txt22
-rwxr-xr-xqpid/dotnet/build-mono2
-rwxr-xr-xqpid/dotnet/build-nant-release21
-rw-r--r--qpid/dotnet/default.build5
11 files changed, 322 insertions, 23 deletions
diff --git a/qpid/dotnet/Consumer/Program.cs b/qpid/dotnet/Consumer/Program.cs
new file mode 100644
index 0000000000..d9a6224a42
--- /dev/null
+++ b/qpid/dotnet/Consumer/Program.cs
@@ -0,0 +1,30 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+namespace Consumer
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Apache.Qpid.Client.Tests.interop.Consumer.Main(args);
+ }
+ }
+}
diff --git a/qpid/dotnet/Consumer/default.build b/qpid/dotnet/Consumer/default.build
new file mode 100644
index 0000000000..5b1e3166c5
--- /dev/null
+++ b/qpid/dotnet/Consumer/default.build
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<project name="Consumer" default="build">
+ <!--
+ Properties that come from master build file
+ - build.dir: root directory for build
+ - build.debug: true if building debug release
+ - build.defines: variables to define during build
+ -->
+
+ <target name="build">
+ <csc target="exe"
+ define="${build.defines}"
+ debug="${build.debug}"
+ unsafe="true"
+ output="${build.dir}/${project::get-name()}.exe">
+
+ <sources>
+ <include name="**/*.cs" />
+ </sources>
+ <references>
+ <include name="${build.dir}\Apache.Qpid.Client.Tests.dll"/>
+ </references>
+ </csc>
+ </target>
+</project>
+
diff --git a/qpid/dotnet/Producer/Program.cs b/qpid/dotnet/Producer/Program.cs
new file mode 100644
index 0000000000..83dbf597ed
--- /dev/null
+++ b/qpid/dotnet/Producer/Program.cs
@@ -0,0 +1,30 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+namespace Producer
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Apache.Qpid.Client.Tests.interop.Producer.Main(args);
+ }
+ }
+}
diff --git a/qpid/dotnet/Producer/default.build b/qpid/dotnet/Producer/default.build
new file mode 100644
index 0000000000..72d2a3fa8d
--- /dev/null
+++ b/qpid/dotnet/Producer/default.build
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<project name="Producer" default="build">
+ <!--
+ Properties that come from master build file
+ - build.dir: root directory for build
+ - build.debug: true if building debug release
+ - build.defines: variables to define during build
+ -->
+
+ <target name="build">
+ <csc target="exe"
+ define="${build.defines}"
+ debug="${build.debug}"
+ unsafe="true"
+ output="${build.dir}/${project::get-name()}.exe">
+
+ <sources>
+ <include name="**/*.cs" />
+ </sources>
+ <references>
+ <include name="${build.dir}\Apache.Qpid.Client.Tests.dll"/>
+ </references>
+ </csc>
+ </target>
+</project>
+
diff --git a/qpid/dotnet/Program.cs b/qpid/dotnet/Program.cs
new file mode 100644
index 0000000000..d9a6224a42
--- /dev/null
+++ b/qpid/dotnet/Program.cs
@@ -0,0 +1,30 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+namespace Consumer
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Apache.Qpid.Client.Tests.interop.Consumer.Main(args);
+ }
+ }
+}
diff --git a/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs b/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs
new file mode 100644
index 0000000000..d60514ae4c
--- /dev/null
+++ b/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs
@@ -0,0 +1,56 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using Apache.Qpid.Client;
+using Apache.Qpid.Messaging;
+
+namespace Apache.Qpid.Client.Tests.interop
+{
+ public class Consumer
+ {
+ public static void Main(string[] args)
+ {
+ try
+ {
+ const string connectionUrl = @"amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'";
+ const string queueName = @"test-queue";
+
+ var connectionInfo = QpidConnectionInfo.FromUrl(connectionUrl);
+ var connection = new AMQConnection(connectionInfo);
+ var channel = connection.CreateChannel(false, AcknowledgeMode.AutoAcknowledge, 1);
+
+ channel.DeclareQueue(queueName, false, true, true);
+ channel.Bind(queueName, ExchangeNameDefaults.DIRECT, queueName);
+ IMessageConsumer consumer = channel.CreateConsumerBuilder(queueName) .Create();
+ connection.Start();
+
+ ITextMessage message = (ITextMessage) consumer.Receive();
+ Console.WriteLine("Got: " + message.Text);
+ connection.Dispose();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ }
+ }
+ }
+}
diff --git a/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs b/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs
new file mode 100644
index 0000000000..d775080fc3
--- /dev/null
+++ b/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs
@@ -0,0 +1,55 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using Apache.Qpid.Client;
+using Apache.Qpid.Messaging;
+
+namespace Apache.Qpid.Client.Tests.interop
+{
+ public class Producer
+ {
+ public static void Main(string[] args)
+ {
+ try
+ {
+ const string connectionUrl = @"amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'";
+ const string queueName = @"test-queue";
+
+ var connectionInfo = QpidConnectionInfo.FromUrl(connectionUrl);
+ var connection = new AMQConnection(connectionInfo);
+ var channel = connection.CreateChannel(false, AcknowledgeMode.AutoAcknowledge);
+ var publisher = channel.CreatePublisherBuilder()
+ .WithExchangeName(ExchangeNameDefaults.DIRECT)
+ .WithRoutingKey(queueName)
+ .Create();
+ IMessage message = channel.CreateTextMessage("0123456789");
+ publisher.Send(message);
+ Console.WriteLine("Sent message");
+ connection.Dispose();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ }
+ }
+ }
+}
diff --git a/qpid/dotnet/README.txt b/qpid/dotnet/README.txt
index 0199ad6410..70830a625c 100644
--- a/qpid/dotnet/README.txt
+++ b/qpid/dotnet/README.txt
@@ -32,6 +32,7 @@ If using nant, set up PATH to include Nant.exe, e.g.:
If using msbuild, it is recommended to use a "Visual Studio Command Prompt"
+
Building
========
@@ -49,6 +50,27 @@ If you are using nant, the script build-nant.bat contains standard arguments tha
To build for Mono on Linux (to bin/mono-2.0) the build-mono shell script is provided.
+Running the Examples
+====================
+
+The tree contains two paired examples that demonstrate some of the features of the library:
+Producer/Consumer and TopicPublisher/TopicListener.
+
+To run on Mono on Linux (cd to bin/mono-2.0) and execute
+
+mono Consumer.exe (in one window , and
+mono Producer.exe in another window)
+
+or:
+
+mono TopicListener.exe (in one window , and
+mono TopicPublisher.exe in another window)
+
+Both examples assume you have a broker running on localhost:5672. You must run Consumer/TopicListener
+before Producer/TopicPublisher in order that queue is created before the first message is sent.
+
+The source code for the examples is in directory Qpid.Client.Tests/interop.
+
Releasing
=========
diff --git a/qpid/dotnet/build-mono b/qpid/dotnet/build-mono
index 2bb6147b53..71d94ad268 100755
--- a/qpid/dotnet/build-mono
+++ b/qpid/dotnet/build-mono
@@ -18,4 +18,4 @@
# under the License.
#
-nant -t:mono-2.0
+nant -t:mono-2.0 "$@"
diff --git a/qpid/dotnet/build-nant-release b/qpid/dotnet/build-nant-release
index 611a1efe08..a6d73dc40a 100755
--- a/qpid/dotnet/build-nant-release
+++ b/qpid/dotnet/build-nant-release
@@ -1,24 +1,3 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
#!/bin/bash
#
#
diff --git a/qpid/dotnet/default.build b/qpid/dotnet/default.build
index 4cd38e90ff..b038307623 100644
--- a/qpid/dotnet/default.build
+++ b/qpid/dotnet/default.build
@@ -62,9 +62,12 @@
<!-- Other test or utility assemblies. -->
<fileset id='other.builds'>
+ <include name="TestClient/default.build" />
+ <!-- Examples -->
<include name="TopicListener/default.build" />
<include name="TopicPublisher/default.build" />
- <include name="TestClient/default.build" />
+ <include name="Consumer/default.build" />
+ <include name="Producer/default.build" />
</fileset>
<!-- Prepare environment for a debug build. -->