tags:

views:

163

answers:

1

I'm writing an app that will create lots of JMS topic subscribers. What is best practise regarding reusing sessions?

A session per subscriber? A pool of sessions? With a session per subscriber the thread count seems unreasonable. Is this a job for something like a ServerSessionPool? What I've seen so far seems to suggest that ServerSessionPool is more geared towards one receiver consuming messages concurrently rather than lots of receivers.

I'm currently working with HornetQ 2.0.0GA embedded in JBoss EAP 4.3.0CP6.

A: 

Most likely you will need many sessions since a session is per-thread. Here's a link to a really good Stack Overflow response that explains the context.

In the unlikely event that your JMS topic subscriptions are all within the same thread, note that they will all also share the same unit of work if its a transacted session.

T.Rob