activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <hi...@hiramchirino.com>
Subject Re: Session, MessageProducer are thread safe
Date Mon, 24 Jul 2006 15:45:49 GMT
Creating a session and producer are cheap compared to creating a
connection.

Synchronizing send from one thread at a time is might be a valid solution.
It depends how long the send() method blocks.  If it blocks too long then
there will be too much contention trying to access the send.  So you want
the send() method not to block, which is the case when ActiveMQ is using
async sends.  For more info on async sends see:
http://incubator.apache.org/activemq/async-sends.html



On 7/21/06, Vishu <vkagrawall@yahoo.com> wrote:
>
>
> My requirement is something like my app will make connection, create
> session
> and MessageProducer... then I have multiple threads to send messages in MQ
> at once...
>
> As I read from JMS spec .. connection is thread safe but session and
> messageProducer are not...
> so I have two options
>
> 1. make send call synchronise ... send from one thread at a time..
> 2. create session and messageProducer for each thread then send message
> concurrently..
>
> I don't know what are performance issues .. in both the situations..
>
> I don't how heavy to create session and messageProduder from every thread
> when thare is send call..
>
> tanx
> vish
>
> --
> View this message in context:
> http://www.nabble.com/Session%2C-MessageProducer-are-thread-safe-tf1980059.html#a5437544
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message