activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaguarg <fotsh...@gmail.com>
Subject Re: How to publish only if active subscribers?
Date Sat, 28 Nov 2009 21:10:04 GMT

Hi, 

I came across this http://activemq.apache.org/advisory-message.html   I
guess advisory message could be used. any practical example? 

Thanks
-- 
jaguarg

jaguarg wrote:
> 
> Hi, 
> I would like to implement a feature where I only publish on a specific
> topic if there is one or more subscribers listening on for this topic?
> This is my sample code:
>  ActiveMQConnectionFactory factory = new
> ActiveMQConnectionFactory("tcp://<MY ACTIVEMQ HOST>:61616");
>         connection = factory.createConnection();
>         session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> ... 
> 
>  Topic topic = session.createTopic(<MY TOPIC>);
>    MessageProducer publisher = session.createProducer(topic);
>             publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>             publisher.send(session.createTextMessage(<MY DATA>);
> 
> How do I avoid pushing this data if there are not subscriber? 
> 
> Thanks
> 
> --
> jaguarg
> 

-- 
View this message in context: http://old.nabble.com/How-to-publish-only-if-active-subscribers--tp26545404p26556997.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message