activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: One connection for multiple sessions or one connection for each session
Date Tue, 27 Feb 2007 09:13:05 GMT
On 2/27/07, LiXiao2007 <> wrote:
> I would like to write a program with multiple threads. Each thread will
> subscribe same mesage queue. There are two ways to do that.
> 1. Each thread has its own connection and session to the queue.
> 2. All the threads share same connection and each thread has its own
> session.
> I don't know which way is better. Any help is greatly appreciated.

You generally only need one connection; just make sure you have many
sessions (typically one per consumer is the best concurrency).

Some folks have found cases when doing lots of durable publishing that
more than one connection can help (maybe one connection for producing
messages is sometimes slightly faster), but for consuming, generally
only one connection is needed.


View raw message