Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D95FE4004 for ; Thu, 7 Jul 2011 15:07:56 +0000 (UTC) Received: (qmail 98259 invoked by uid 500); 7 Jul 2011 15:07:56 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 98196 invoked by uid 500); 7 Jul 2011 15:07:55 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 98188 invoked by uid 99); 7 Jul 2011 15:07:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 15:07:55 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of Ishitori@bk.ru does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 15:07:49 +0000 Received: from joe.nabble.com ([192.168.236.139]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1QeqAq-0007B0-4s for users@activemq.apache.org; Thu, 07 Jul 2011 08:07:28 -0700 Date: Thu, 7 Jul 2011 08:07:28 -0700 (PDT) From: Ishitori To: users@activemq.apache.org Message-ID: <1310051248127-3651760.post@n4.nabble.com> Subject: IMessageProducer and IMessageConsumer lifecycle best practices MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello everyone. I use Apache.NMS and its two main interfaces: IMessageProducer and IMessageConsumer. I have created a wrapper on a IMessageProducer and IMessageConsumer, so my system wouldn't know that ActiveMQ is used underneath. I can implement wrappers using following scenario: 1. I can create IMessageProducer in constuctor of the wrapper. When client code calls my wrapper SendMessage method I will just redirect it to Send method of the IMessageProducer. 2. I can create IMessageProducer on the fly when my wrapper SendMessage method is called. After creating I call IMessageProducer.Send method So, basically in the first case I have a connection opened all the time, but I save some time on creating objects, when in the latter case I open a connection for a short period of time, but at the same time I have to create everything from the scratch. What solution is more preferable? The same quesion is for the IMessageConsumer and Receive method. -- View this message in context: http://activemq.2283324.n4.nabble.com/IMessageProducer-and-IMessageConsumer-lifecycle-best-practices-tp3651760p3651760.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.