Return-Path: Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: (qmail 2584 invoked from network); 3 Jan 2011 17:00:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Jan 2011 17:00:03 -0000 Received: (qmail 3933 invoked by uid 500); 3 Jan 2011 17:00:03 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 3878 invoked by uid 500); 3 Jan 2011 17:00:01 -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 3869 invoked by uid 99); 3 Jan 2011 17:00:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jan 2011 17:00:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Mon, 03 Jan 2011 17:00:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0DE4523888E8; Mon, 3 Jan 2011 16:59:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1054684 - in /qpid/trunk/qpid/cpp/bindings/qpid/dotnet: examples/csharp.example.drain/csharp.example.drain.cs src/Receiver.cpp src/Receiver.h Date: Mon, 03 Jan 2011 16:59:39 -0000 To: commits@qpid.apache.org From: chug@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110103165940.0DE4523888E8@eris.apache.org> Author: chug Date: Mon Jan 3 16:59:39 2011 New Revision: 1054684 URL: http://svn.apache.org/viewvc?rev=1054684&view=rev Log: .NET Binding for Qpid Messaging: Add the boolean variation of Get() and Fetch(). Modify drain example to use the boolean Fetch. Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs?rev=1054684&r1=1054683&r2=1054684&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs (original) +++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs Mon Jan 3 16:59:39 2011 @@ -43,9 +43,9 @@ namespace Org.Apache.Qpid.Messaging.Exam Duration timeout = options.Forever ? DurationConstants.FORVER : DurationConstants.SECOND * options.Timeout; - Message message; + Message message = new Message(); - while ((message = receiver.Fetch(timeout)) != null) + while (receiver.Fetch(ref message, timeout)) { Dictionary properties = new Dictionary(); properties = message.Properties; Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp?rev=1054684&r1=1054683&r2=1054684&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp (original) +++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp Mon Jan 3 16:59:39 2011 @@ -121,24 +121,43 @@ namespace Messaging { // // Get(message) // - // TBD - //bool Receiver::Get(Message ^ mmsgp) - //{ - // return Get(mmsgp, DurationConstants::FORVER); - //} - // - //bool Receiver::Get(Message ^ mmsgp, Duration ^ durationp) - //{ - // ::qpid::messaging::Duration dur((*durationp).Milliseconds); - // - // ::qpid::messaging::Message tmpMsg; - // - // bool result = receiverp->Receiver::get(tmpMsg, dur); - // - // mmsgp = gcnew Message(tmpMsg); - // - // return result; - //} + bool Receiver::Get(Message ^% mmsgp) + { + return Get(mmsgp, DurationConstants::FORVER); + } + + bool Receiver::Get(Message ^% mmsgp, Duration ^ durationp) + { + System::Exception ^ newException = nullptr; + + try + { + ::qpid::messaging::Duration dur((*durationp).Milliseconds); + + ::qpid::messaging::Message tmpMsg; + + bool result = receiverp->Receiver::get(tmpMsg, dur); + + if (result) + { + mmsgp = gcnew Message(tmpMsg); + } + + return result; + } + catch (const ::qpid::types::Exception & error) + { + String ^ errmsg = gcnew String(error.what()); + newException = gcnew QpidException(errmsg); + } + + if (newException != nullptr) + { + throw newException; + } + + return false; + } // // message = Get() @@ -192,24 +211,42 @@ namespace Messaging { // // Fetch(message) // - // TBD - //bool Receiver::Fetch(Message ^ mmsgp) - //{ - // return Fetch(mmsgp, DurationConstants::FORVER); - //} - // - //bool Receiver::Fetch(Message ^ mmsgp, Duration ^ durationp) - //{ - // ::qpid::messaging::Duration dur((*durationp).Milliseconds); - // - // ::qpid::messaging::Message tmpMsg; - // - // bool result = receiverp->Receiver::fetch(tmpMsg, dur); - // - // mmsgp = gcnew Message(tmpMsg); - // - // return result; - //} + bool Receiver::Fetch(Message ^% mmsgp) + { + return Fetch(mmsgp, DurationConstants::FORVER); + } + + bool Receiver::Fetch(Message ^% mmsgp, Duration ^ durationp) + { + System::Exception ^ newException = nullptr; + + try + { + ::qpid::messaging::Duration dur((*durationp).Milliseconds); + + ::qpid::messaging::Message tmpMsg; + + bool result = receiverp->Receiver::fetch(tmpMsg, dur); + + if (result) + { + mmsgp = gcnew Message(tmpMsg); + } + + return result; + } + catch (const ::qpid::types::Exception & error) + { + String ^ errmsg = gcnew String(error.what()); + newException = gcnew QpidException(errmsg); + } + if (newException != nullptr) + { + throw newException; + } + + return false; + } // Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h?rev=1054684&r1=1054683&r2=1054684&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h (original) +++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h Mon Jan 3 16:59:39 2011 @@ -99,18 +99,16 @@ namespace Messaging { } // Get(message) - // TBD - //bool Get(Message ^ mmsgp); - //bool Get(Message ^ mmsgp, Duration ^ durationp); + bool Get(Message ^% mmsgp); + bool Get(Message ^% mmsgp, Duration ^ durationp); // message = Get() Message ^ Get(); Message ^ Get(Duration ^ durationp); // Fetch(message) - // TBD - //bool Fetch(Message ^ mmsgp); - //bool Fetch(Message ^ mmsgp, Duration ^ duration); + bool Fetch(Message ^% mmsgp); + bool Fetch(Message ^% mmsgp, Duration ^ duration); // message = Fetch() Message ^ Fetch(); --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscribe@qpid.apache.org