From commits-return-13486-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Thu Apr 22 22:35:05 2010 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 47416 invoked from network); 22 Apr 2010 22:35:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Apr 2010 22:35:05 -0000 Received: (qmail 73921 invoked by uid 500); 22 Apr 2010 22:35:04 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 73898 invoked by uid 500); 22 Apr 2010 22:35:04 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 73891 invoked by uid 99); 22 Apr 2010 22:35:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Apr 2010 22:35:04 +0000 X-ASF-Spam-Status: No, hits=-1001.3 required=10.0 tests=ALL_TRUSTED,AWL 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; Thu, 22 Apr 2010 22:35:04 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D1A5C238899B; Thu, 22 Apr 2010 22:34:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r937090 - in /activemq/activemq-dotnet/Apache.NMS/trunk: src/main/csharp/MessageConsumerExtensions.cs vs2008-nms.csproj Date: Thu, 22 Apr 2010 22:34:21 -0000 To: commits@activemq.apache.org From: jgomes@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100422223421.D1A5C238899B@eris.apache.org> Author: jgomes Date: Thu Apr 22 22:34:21 2010 New Revision: 937090 URL: http://svn.apache.org/viewvc?rev=937090&view=rev Log: Added MessageConsumerExtensions for cleaner code usage. Added: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/MessageConsumerExtensions.cs Modified: activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj Added: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/MessageConsumerExtensions.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/MessageConsumerExtensions.cs?rev=937090&view=auto ============================================================================== --- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/MessageConsumerExtensions.cs (added) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/MessageConsumerExtensions.cs Thu Apr 22 22:34:21 2010 @@ -0,0 +1,52 @@ +/* + * 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 System.Text; +using Apache.NMS.Util; + +namespace Apache.NMS +{ +#if NET_3_5 || MONO + public static class MessageConsumerExtensions + { + /// + /// Receives the message from the destination for this consumer. The object must be de-serializable from XML. + /// + public static T Receive(this IMessageConsumer consumer) where T : class + { + return consumer.Receive().ToObject(); + } + + /// + /// Receives the message from the destination for this consumer. The object must be de-serializable from XML. + /// + public static T Receive(this IMessageConsumer consumer, TimeSpan timeout) where T : class + { + return consumer.Receive(timeout).ToObject(); + } + + /// + /// Receives the message from the destination for this consumer. The object must be de-serializable from XML. + /// + public static T ReceiveNoWait(this IMessageConsumer consumer) where T : class + { + return consumer.ReceiveNoWait().ToObject(); + } + } +#endif +} Modified: activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj?rev=937090&r1=937089&r2=937090&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj Thu Apr 22 22:34:21 2010 @@ -74,6 +74,7 @@ +