activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: Detect consumers?
Date Mon, 19 May 2008 06:52:02 GMT
Can you post your entire code - preferably as a junit test case  
attached to a jira ?


cheers,

Rob

http://open.iona.com/products/enterprise-activemq
http://rajdavies.blogspot.com/


On 19 May 2008, at 07:22, beaker wrote:

>
> Hello,
>
> I tried the Advisory Topics, but somehow I can not manage to get any
> advisory messages...
>
> I have tested this with a small test server I have found here:
> http://coenraets.org/blog/2007/01/flex-test-drive-server-for-java-developers-tomcat-based/
>
> This is a piece of code where I tried to set up a consumer for the  
> advisory
> messages:
>
>            ActiveMQDestination topic = (ActiveMQDestination)
> context.lookup("ChatTopic");
>
>            Destination advisoryDestination =
> AdvisorySupport.getConsumerAdvisoryTopic(topic);
>
>            MessageConsumer consumer =
> session.createConsumer(advisoryDestination);
>
> Then I tried to connect some consumers to the topic "ChatTopic", but  
> I never
> get an advisory message. Can you tell me what is wrong? Is there  
> maybe some
> kind of example or tutorial on how to do this?
>
> Cheers,
> beaker
>
>
> James.Strachan wrote:
>>
>> 2008/5/8 beaker <beaker222@freenet.de>:
>>>
>>> Hello,
>>>
>>> is it possible for a producer to detect, if there are any  
>>> consumers on
>>> the
>>> topic/queue he is sending?
>>
>> Yes - you can use advisories...
>> http://activemq.apache.org/advisory-message.html
>>
>> e.g. try using the ConsumerEventSource helper class...
>> http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/advisory/ConsumerEventSource.html
>>
>>> I want the producer to only send out messages, if there is someone
>>> listening
>>> for them.
>>
>> We could maybe enhance the JMS client so that it can avoid sending
>> messages to topics which have no consumers (i.e. to reduce the cost  
>> of
>> marshalling the message on the wire and sending it to the broker and
>> the broker consuming it).
>>
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://open.iona.com
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Detect-consumers--tp17126905s2354p17311984.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>







Mime
View raw message