How to create multiple subscribers and producers in a application

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create multiple subscribers and producers in a application

Sophia Wright
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


Reply | Threaded
Open this post in threaded view
|

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

Noel OConnor
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" <[hidden email]> 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.
>
Reply | Threaded
Open this post in threaded view
|

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

Sophia Wright
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
Reply | Threaded
Open this post in threaded view
|

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

Matt Pavlovich-2
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 <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

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

Noel OConnor
In reply to this post by Sophia Wright
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 <[hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

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

Sophia Wright
In reply to this post by Matt Pavlovich-2
> 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
Reply | Threaded
Open this post in threaded view
|

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

artnaseef
This post was updated on .
With the DMLC 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.
Reply | Threaded
Open this post in threaded view
|

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

Matt Pavlovich-2
In reply to this post by Sophia Wright
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 <[hidden email]> 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.