Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 1365 invoked from network); 13 Sep 2010 03:39:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Sep 2010 03:39:38 -0000 Received: (qmail 42423 invoked by uid 500); 13 Sep 2010 03:39:37 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 42183 invoked by uid 500); 13 Sep 2010 03:39:35 -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 42175 invoked by uid 99); 13 Sep 2010 03:39:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Sep 2010 03:39:34 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bruce.snyder@gmail.com designates 209.85.214.171 as permitted sender) Received: from [209.85.214.171] (HELO mail-iw0-f171.google.com) (209.85.214.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Sep 2010 03:39:30 +0000 Received: by iwn42 with SMTP id 42so10269380iwn.2 for ; Sun, 12 Sep 2010 20:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=yMakzTC3bspVNfMagEEyH+RhkuionKKB/R4FmHEea6I=; b=FkXBGmX9425giENDlZxvMmZTNF1mqeyAgwVqrbbN7DWBInXVMzzeiJHp2o0uZtuMzM JWmj8oYvbscwvq56dL7x0gbRlRmDl3Zu4Osthu3z7XZZYWnsOIg7qHSfWwYAK8/n4qhq 9YQaKCNneXyuBi1Zclz3zt0P2mdKah/QGayGw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=uIoveCjWydHPGfOqMe8Y4FUStygDljKoRP/So9x/6mY3hQNsXQ9oihOvmvDQR+BcQI oEiKkyl97WLS76dThG41W+G5C7K4dmLTLJ/0KKnUUI//aAMrDv+RWhGO4VlUTh3ErO6g IPBCJ+c7pRsxwy5tCD4n73kFZXTUDN2qmxDqE= MIME-Version: 1.0 Received: by 10.231.191.6 with SMTP id dk6mr5456476ibb.51.1284349149341; Sun, 12 Sep 2010 20:39:09 -0700 (PDT) Received: by 10.231.115.166 with HTTP; Sun, 12 Sep 2010 20:39:09 -0700 (PDT) In-Reply-To: <1284317543987-2536577.post@n4.nabble.com> References: <1284317543987-2536577.post@n4.nabble.com> Date: Sun, 12 Sep 2010 21:39:09 -0600 Message-ID: Subject: Re: How do I use the PooledConnectionFactory? From: Bruce Snyder To: users@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 On Sun, Sep 12, 2010 at 12:52 PM, swapnonil wrote: > > Hi Everybody, > > I am new to ActiveMQ. For the past 3 months I have been using HornetQ with > JBoss 5.1 and am pretty much feed up with HornetQ, JBoss and the whole > Resource Adapter XML tag soup. The lessons that I have learnt by using > JBoss+HornetQ and by reading through the Geronimo documentation are > > > The Resource Adapter tag soup is ok to work with if all you want is a single > server. But the moment you try to set up a cluster (master/slave or load > balanced) of brokers things either break down or are so hard to do that you > give up halfway. > Setting up a cluster of JMS brokers on any App Server including Geronimo is > poorly documented. > > > Which is why I have decided that it may be a good idea to go with a pure JMS > setup. > > I intend to use ActiveMQ is this manner. > > We have multiple Web Servers and Job Servers each running on their own > individual JVMs. These JVMs totaling 8 at present need to submit messages > onto a queue. There will be a set of consumers which will read these > message, create SOLR documents and post them to a SOLR server for Indexing. > The whole idea of using messaging, is that creating a SOLR document is time > consuming. The application cannot afford to wait for this to complete. So > the application (web servers and job servers) just puts a message onto a > Queue and a Consumer would then create the SOLR doc and post it to SOLR. > > From what I seen of the code in PooledConnectionFactory, it seems to be good > for use inside the JVMs hosting the Web Servers or the Job Servers. > > But my question is, How do I use PooledConnnectionFactory? > > Is this intended to be instantiated only once inside a particular JVM? > > That is should I create Singleton (Manager kind of) to work with > PooledConnection Factory? The PooledConnectionFactory provides a pool of connections and sessions so that the client side applications can operate in a more efficient manner by not opening and closing connections and sessions repeatedly. The PooledConnectionFactory is intended to be used on the client side for sending and receiving messages. But do not wrap it in a singleton. That will defeat the purpose of PooledConnectionFactory. There is an example of using the PooledConnectionFactory available here: http://activemq.apache.org/spring-support.html Also note the links at the bottom of that page under the More Information header. The resources listed there provide some pretty good information regarding ActiveMQ and Spring. Bruce -- perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E