activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Co <...@exist.com>
Subject Re: send(topic, msg)
Date Mon, 16 Oct 2006 02:41:31 GMT

Hi,

Yep. It's more efficient as you don't need to create the producer resources
over and over again. You might also consider using composite destinations if
you are sending the same message to different destinations.
http://www.activemq.org/site/composite-destinations.html



Andy Czerwonka-2 wrote:
> 
> thanks - I finally googled it and found it.  I take it this is more 
> efficient than creating publishers every time?
> 
> "Rob Davies" <rajdavies@gmail.com> wrote in 
> message news:B5AB8B24-9A30-4F35-BB56-A476D282ED6A@gmail.com...
>> To create a generic publisher - you should create it with a null 
>> destination (this is a JMS spec thing)
>> e.g.
>>
>> TopicPublisher publisher = session.createPublisher(null);
>> publisher.publish(topic,msg);
>>
>> cheers,
>>
>> Rob
>> On 14 Oct 2006, at 13:02, Andy Czerwonka wrote:
>>
>>> Should I be creating a new publisher for every send like this?  Or 
>>> should I
>>> be using the send(topic, msg) method?  If the latter, then how do I 
>>> create a
>>> generic publisher?  From what I can see, I can't create a publisher 
>>> without
>>> a Topic.  Help.
>>>
>>> Topic topic = getDestination(msg);
>>>
>>> TopicPublisher publisher = createPublisher(topic);
>>>
>>> TextMessage message = _topicSession.createTextMessage(msg);
>>>
>>> publisher.send(message);
>>>
>>>
>>>
>>>
>>
>> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/send%28topic%2C-msg%29-tf2442340.html#a6827688
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message