You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ma...@apache.org on 2011/02/23 12:47:22 UTC

svn commit: r1073704 - in /qpid/trunk/qpid/dotnet: ./ Consumer/ Producer/ Qpid.Client.Tests/interop/

Author: marnie
Date: Wed Feb 23 11:47:21 2011
New Revision: 1073704

URL: http://svn.apache.org/viewvc?rev=1073704&view=rev
Log:
QPID-3062 new examples for 0-8 dotnet client

Added:
    qpid/trunk/qpid/dotnet/Consumer/
    qpid/trunk/qpid/dotnet/Consumer/Program.cs
    qpid/trunk/qpid/dotnet/Consumer/default.build
    qpid/trunk/qpid/dotnet/Producer/
    qpid/trunk/qpid/dotnet/Producer/Program.cs
    qpid/trunk/qpid/dotnet/Producer/default.build
    qpid/trunk/qpid/dotnet/Program.cs
    qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs
    qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs
Modified:
    qpid/trunk/qpid/dotnet/README.txt
    qpid/trunk/qpid/dotnet/build-mono
    qpid/trunk/qpid/dotnet/build-nant-release
    qpid/trunk/qpid/dotnet/default.build

Added: qpid/trunk/qpid/dotnet/Consumer/Program.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Consumer/Program.cs?rev=1073704&view=auto
==============================================================================
--- qpid/trunk/qpid/dotnet/Consumer/Program.cs (added)
+++ qpid/trunk/qpid/dotnet/Consumer/Program.cs Wed Feb 23 11:47:21 2011
@@ -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);
+        }
+    }
+}

Added: qpid/trunk/qpid/dotnet/Consumer/default.build
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Consumer/default.build?rev=1073704&view=auto
==============================================================================
--- qpid/trunk/qpid/dotnet/Consumer/default.build (added)
+++ qpid/trunk/qpid/dotnet/Consumer/default.build Wed Feb 23 11:47:21 2011
@@ -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>
+

Added: qpid/trunk/qpid/dotnet/Producer/Program.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Producer/Program.cs?rev=1073704&view=auto
==============================================================================
--- qpid/trunk/qpid/dotnet/Producer/Program.cs (added)
+++ qpid/trunk/qpid/dotnet/Producer/Program.cs Wed Feb 23 11:47:21 2011
@@ -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);
+        }
+    }
+}

Added: qpid/trunk/qpid/dotnet/Producer/default.build
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Producer/default.build?rev=1073704&view=auto
==============================================================================
--- qpid/trunk/qpid/dotnet/Producer/default.build (added)
+++ qpid/trunk/qpid/dotnet/Producer/default.build Wed Feb 23 11:47:21 2011
@@ -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>
+

Added: qpid/trunk/qpid/dotnet/Program.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Program.cs?rev=1073704&view=auto
==============================================================================
--- qpid/trunk/qpid/dotnet/Program.cs (added)
+++ qpid/trunk/qpid/dotnet/Program.cs Wed Feb 23 11:47:21 2011
@@ -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);
+        }
+    }
+}

Added: qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs?rev=1073704&view=auto
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs (added)
+++ qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Consumer.cs Wed Feb 23 11:47:21 2011
@@ -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);
+            }
+        }
+    }
+}

Added: qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs?rev=1073704&view=auto
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs (added)
+++ qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/Producer.cs Wed Feb 23 11:47:21 2011
@@ -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);
+            }
+        }
+    }
+}

Modified: qpid/trunk/qpid/dotnet/README.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/README.txt?rev=1073704&r1=1073703&r2=1073704&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/README.txt (original)
+++ qpid/trunk/qpid/dotnet/README.txt Wed Feb 23 11:47:21 2011
@@ -32,6 +32,7 @@ If using nant, set up PATH to include Na
 
 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-
  
 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
 =========
 

Modified: qpid/trunk/qpid/dotnet/build-mono
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/build-mono?rev=1073704&r1=1073703&r2=1073704&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/build-mono (original)
+++ qpid/trunk/qpid/dotnet/build-mono Wed Feb 23 11:47:21 2011
@@ -18,4 +18,4 @@
 # under the License.
 #
 
-nant -t:mono-2.0
+nant -t:mono-2.0 "$@"

Modified: qpid/trunk/qpid/dotnet/build-nant-release
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/build-nant-release?rev=1073704&r1=1073703&r2=1073704&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/build-nant-release (original)
+++ qpid/trunk/qpid/dotnet/build-nant-release Wed Feb 23 11:47:21 2011
@@ -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
 #
 # 

Modified: qpid/trunk/qpid/dotnet/default.build
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/default.build?rev=1073704&r1=1073703&r2=1073704&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/default.build (original)
+++ qpid/trunk/qpid/dotnet/default.build Wed Feb 23 11:47:21 2011
@@ -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. -->



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org