You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Sophia Wright <so...@gmail.com> on 2014/08/12 13:13:41 UTC

How to create multiple subscribers and producers in a application

Hi,

I want to create 7 producers and 5 durable consumers in my application
connecting to the same broker. I want to use spring Default message listener
container to create consumers and JMStemplate to create producers.

While reading I am confused about how connection factories should be used. I
was going through the posts and question about pooledConenctionFactory. Some
confusion: 

1) Can I use "PooledConnectionFactory" for my use case. Would it cause any
trouble if I use durable subscriber and specify maxConnection in
"PooledConnectionFactory" to the required connections(12) ? 


~ Sophia






--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to create multiple subscribers and producers in a application

Posted by Noel OConnor <no...@gmail.com>.
Sorry I gave you the wrong info, its the SpringJMSTemplate that uses a
connection per message. So use a pooled or cached connection factory
for that.

As for the consumers I don't think you need a pooled/cached connection.

See

http://stackoverflow.com/questions/19560479/which-is-better-pooledconnectionfactory-or-cachingconnectionfactory


On Wed, Aug 13, 2014 at 4:00 PM, Sophia Wright <so...@gmail.com> wrote:
> Hi,
>
> And how should I use pooledConnection factory.
> Should I use different pooled ConenctionFactory for each listener and
> producer
> or should I use only one pooled connection factory with maxConnection to
> required number.
>
> I can a see a similar thread
> http://activemq.2283324.n4.nabble.com/javax-jms-InvalidClientIDException-for-durable-subscription-on-broker-restart-td4684381.html
>
>
>
>
> ~ Sophia
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440p4684504.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to create multiple subscribers and producers in a application

Posted by artnaseef <ar...@artnaseef.com>.
With the DLMC and durable Topic subscribers, don't use a pooled connection -
use one connection.  Separate connections per consumer can improve
throughput, but otherwise are not necessary - unless different Client ID's
are being used.



--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440p4684761.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to create multiple subscribers and producers in a application

Posted by Matt Pavlovich <ma...@gmail.com>.
Sophia-

I suggest starting with a single connection per consumer. That model performs well for most applications. You can then look to add multiple consumers on top of a connection (maybe 4 max) and then look to add additional connections to scale consumption.  

-Matt

On Aug 19, 2014, at 2:37 AM, Sophia Wright <so...@gmail.com> wrote:

>> I don’t recommend using the same pool for consumers (especially if you use
> local or XA transactions).  The > benefit is pretty minimal, and it can
> cause issues once you start scaling.
> 
> So should I use different pooled Connection factory for each listener in my
> application ? OR  should I not at all use pooledConnectionFactory ? 
> 
> 
> 
> Thanks,
> Sophia
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440p4684737.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How to create multiple subscribers and producers in a application

Posted by Sophia Wright <so...@gmail.com>.
> I don’t recommend using the same pool for consumers (especially if you use
local or XA transactions).  The > benefit is pretty minimal, and it can
cause issues once you start scaling.

So should I use different pooled Connection factory for each listener in my
application ? OR  should I not at all use pooledConnectionFactory ? 



Thanks,
Sophia



--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440p4684737.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to create multiple subscribers and producers in a application

Posted by Matt Pavlovich <ma...@gmail.com>.
I don’t recommend using the same pool for consumers (especially if you use local or XA transactions).  The benefit is pretty minimal, and it can cause issues once you start scaling.

I don’t see pooling being a big boost for the number of total connections you are describing, but it might make configuration management easier.

On Aug 13, 2014, at 1:00 AM, Sophia Wright <so...@gmail.com> wrote:

> Hi, 
> 
> And how should I use pooledConnection factory. 
> Should I use different pooled ConenctionFactory for each listener and
> producer 
> or should I use only one pooled connection factory with maxConnection to
> required number.
> 
> I can a see a similar thread
> http://activemq.2283324.n4.nabble.com/javax-jms-InvalidClientIDException-for-durable-subscription-on-broker-restart-td4684381.html 
> 
> 
> 
> 
> ~ Sophia
> 
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440p4684504.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How to create multiple subscribers and producers in a application

Posted by Sophia Wright <so...@gmail.com>.
Hi, 

And how should I use pooledConnection factory. 
Should I use different pooled ConenctionFactory for each listener and
producer 
or should I use only one pooled connection factory with maxConnection to
required number.

I can a see a similar thread
http://activemq.2283324.n4.nabble.com/javax-jms-InvalidClientIDException-for-durable-subscription-on-broker-restart-td4684381.html 




~ Sophia




--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440p4684504.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to create multiple subscribers and producers in a application

Posted by Noel OConnor <no...@gmail.com>.
The spring dlmc opens a connection to send a message and then closes the
connection. This puts a lot of load on the broker. Using a pooled
connection factory gets around this by reusing the connections.
On Aug 12, 2014 9:14 PM, "Sophia Wright" <so...@gmail.com> wrote:

> Hi,
>
> I want to create 7 producers and 5 durable consumers in my application
> connecting to the same broker. I want to use spring Default message
> listener
> container to create consumers and JMStemplate to create producers.
>
> While reading I am confused about how connection factories should be used.
> I
> was going through the posts and question about pooledConenctionFactory.
> Some
> confusion:
>
> 1) Can I use "PooledConnectionFactory" for my use case. Would it cause any
> trouble if I use durable subscriber and specify maxConnection in
> "PooledConnectionFactory" to the required connections(12) ?
>
>
> ~ Sophia
>
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-create-multiple-subscribers-and-producers-in-a-application-tp4684440.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>