qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1406713 - in /qpid/trunk/qpid/cpp/bindings/qpid/dotnet: examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs src/sessionreceiver/sessionreceiver.cs
Date Wed, 07 Nov 2012 16:41:21 GMT
Author: chug
Date: Wed Nov  7 16:41:20 2012
New Revision: 1406713

URL: http://svn.apache.org/viewvc?rev=1406713&view=rev
Log:
QPID-4426 Add exception callback to sessionreceiver callback server.
This patch fixes the server and the csharp.map.callback.receiver.cs client example.

Modified:
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
    qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs?rev=1406713&r1=1406712&r2=1406713&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
(original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
Wed Nov  7 16:41:20 2012
@@ -153,6 +153,20 @@ namespace Org.Apache.Qpid.Messaging.Exam
 
 
         /// <summary>
+        /// SessionReceiver implements the ISessionReceiver interface.
+        /// It is the exception function that receives all exception messages
+        /// It may be called any time server is running.
+        /// It is always called on server's private thread.
+        /// After this is called then the sessionReceiver and private thread are closed.
+        /// </summary>
+        /// <param name="exception">The exception.</param>
+        public void SessionException(Exception exception)
+        {
+            Console.WriteLine("{0} Exception caught.", exception.ToString());
+        }
+
+
+        /// <summary>
         /// Usage
         /// </summary>
         /// <param name="url">Connection target</param>

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs?rev=1406713&r1=1406712&r2=1406713&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs Wed Nov
 7 16:41:20 2012
@@ -37,6 +37,7 @@ namespace Org.Apache.Qpid.Messaging.Sess
     public interface ISessionReceiver
     {
         void SessionReceiver(Receiver receiver, Message message);
+        void SessionException(Exception exception);
     }
 
     
@@ -67,25 +68,32 @@ namespace Org.Apache.Qpid.Messaging.Sess
         {
             Receiver rcvr;
             Message  msg;
-
-            keepRunning = true;
-            while (keepRunning)
+            try
             {
-                rcvr = session.NextReceiver(DurationConstants.SECOND);
-
-                if (null != rcvr)
+                keepRunning = true;
+                while (keepRunning)
                 {
-                    if (keepRunning)
+                    rcvr = session.NextReceiver(DurationConstants.SECOND);
+
+                    if (null != rcvr)
                     {
-                        msg = rcvr.Fetch(DurationConstants.SECOND);
-                        this.callback.SessionReceiver(rcvr, msg);
+                        if (keepRunning)
+                        {
+                            msg = rcvr.Fetch(DurationConstants.SECOND);
+                            this.callback.SessionReceiver(rcvr, msg);
+                        }
                     }
+                    //else
+                    //    receive timed out
+                    //    EventEngine exits the nextReceiver() function periodically
+                    //    in order to test the keepRunning flag
                 }
-                //else
-                //    receive timed out
-                //    EventEngine exits the nextReceiver() function periodically
-                //    in order to test the keepRunning flag
             }
+            catch (Exception e)
+            {
+                this.callback.SessionException(e);
+            }
+
             // Private thread is now exiting.
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message