activemq-users mailing list archives

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

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://francisotshudi-laptop: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--tp26545404p26545404.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message