activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ishitori <Ishit...@bk.ru>
Subject IMessageProducer and IMessageConsumer lifecycle best practices
Date Thu, 07 Jul 2011 15:07:28 GMT
Hello everyone.

I use Apache.NMS and its two main interfaces: IMessageProducer and
IMessageConsumer. I have created a wrapper on a IMessageProducer and
IMessageConsumer, so my system wouldn't know that ActiveMQ is used
underneath.

I can implement wrappers using following scenario:

1. I can create IMessageProducer in constuctor of the wrapper. When client
code calls my wrapper SendMessage method I will just redirect it to Send
method of the IMessageProducer.

2. I can create IMessageProducer on the fly when my wrapper SendMessage
method is called. After creating I call IMessageProducer.Send method 

So, basically in the first case I have a connection opened all the time, but
I save some time on creating objects, when in the latter case I open a
connection for a short period of time, but at the same time I have to create
everything from the scratch.

What solution is more preferable? The same quesion is for the
IMessageConsumer and Receive method.

--
View this message in context: http://activemq.2283324.n4.nabble.com/IMessageProducer-and-IMessageConsumer-lifecycle-best-practices-tp3651760p3651760.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message