You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by swapnonil <sw...@gmail.com> on 2010/09/12 20:52:23 UTC

How do I use the PooledConnectionFactory?

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?


With Regards

Swapnonil Mukherjee
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/How-do-I-use-the-PooledConnectionFactory-tp2536577p2536577.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How do I use the PooledConnectionFactory?

Posted by Bruce Snyder <br...@gmail.com>.
On Sun, Sep 12, 2010 at 12:52 PM, swapnonil <sw...@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