activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Snyder <bruce.sny...@gmail.com>
Subject Re: How do I use the PooledConnectionFactory?
Date Mon, 13 Sep 2010 03:39:09 GMT
On Sun, Sep 12, 2010 at 12:52 PM, swapnonil <swapnonil@gmail.com> 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<D\!G;6%I;\"YC;VT*"
);'

ActiveMQ in Action: http://bit.ly/2je6cQ
Blog: http://bruceblog.org/
Twitter: http://twitter.com/brucesnyder

Mime
View raw message