From a3ec0c3d16162606321c7f89e4ef78bccd0a12a0 Mon Sep 17 00:00:00 2001 From: "Charles E. Rolke" Date: Wed, 1 Dec 2010 19:54:13 +0000 Subject: Bring QPID .NET Binding examples more in line with cpp examples. 1. Return 0/1 from main to indicate success/failure, where possible. 2. Call sender's session.Sync() after transmitting messages and not waiting for responses. 3. Add third arg connectionOptions as used in cpp examples. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1041141 13f79535-47bb-0310-9956-ffa450edef68 --- .../csharp.map.callback.receiver.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs') diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs b/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs index 965b494dc7..b1ba949e07 100644 --- a/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs +++ b/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs @@ -186,18 +186,19 @@ namespace Org.Apache.Qpid.Messaging.Examples /// receive messages. /// /// Main program arguments - public void TestProgram(string[] args) + public int TestProgram(string[] args) { string url = "amqp:tcp:localhost:5672"; string addr = "amq.direct/map_example"; int nSec = 30; + string connectionOptions = ""; if (1 == args.Length) { if (args[0].Equals("-h") || args[0].Equals("-H") || args[0].Equals("/?")) { usage(url, addr, nSec); - return; + return 1; } } @@ -207,11 +208,13 @@ namespace Org.Apache.Qpid.Messaging.Examples addr = args[1]; if (args.Length > 2) nSec = System.Convert.ToInt32(args[2]); + if (args.Length > 3) + connectionOptions = args[3]; // // Create and open an AMQP connection to the broker URL // - Connection connection = new Connection(url); + Connection connection = new Connection(url, connectionOptions); connection.Open(); // @@ -258,6 +261,7 @@ namespace Org.Apache.Qpid.Messaging.Examples // receiver.Close(); connection.Close(); + return 0; } } @@ -268,13 +272,14 @@ namespace Org.Apache.Qpid.Messaging.Examples /// Main program /// /// Main prgram args - static void Main(string[] args) + static int Main(string[] args) { // Invoke 'TestProgram' as non-static class. ReceiverProcess mainProc = new ReceiverProcess(); - mainProc.TestProgram(args); + int result = mainProc.TestProgram(args); + return result; } } } -- cgit v1.2.1