Some background here...

http://incubator.apache.org/activemq/how-do-i-use-jms-efficiently.html

if you are using non-persistent messaging or are using async sends,
I'd just have a single session and producer and just synchronize
access to them both just in case. Though to behonest the
session.create*Message() methods are all completely thread safe as
they just create POJOs. So its just the MessageProducer.send() method
you need to synchronize on (though again, you probably don't need to
with ActiveMQ to be honest but its worth testing to make sure :).

I guess we could wrap up a MessageProducer that does the
synchronization for you under the covers?


On 7/21/06, Vishu <[EMAIL PROTECTED]> 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.




--

James
-------
http://radio.weblogs.com/0112098/

Reply via email to