Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 637EBD7F6 for ; Wed, 7 Nov 2012 16:41:51 +0000 (UTC) Received: (qmail 71295 invoked by uid 500); 7 Nov 2012 16:41:51 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 71144 invoked by uid 500); 7 Nov 2012 16:41:46 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 71097 invoked by uid 99); 7 Nov 2012 16:41:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2012 16:41:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2012 16:41:42 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5F704238897F for ; Wed, 7 Nov 2012 16:41:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@qpid.apache.org From: chug@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121107164121.5F704238897F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 /// + /// 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. + /// + /// The exception. + public void SessionException(Exception exception) + { + Console.WriteLine("{0} Exception caught.", exception.ToString()); + } + + + /// /// Usage /// /// Connection target 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