that is the retroactive replay of messages for existing consumers/connections implemented by the AdvisoryBroker. The check looks for an exact match for each type of advisory. you will still get advisories for new consumers like a normal topic subscriber.
On 20 April 2014 16:21, xita-de <phamquan...@gmail.com> wrote: > Hi everybody, > > I use AdvisoryMessage to listener subscriber join or leave. If my system is > having two subscribers. After that I run AdvisoryTest and I receive the > result. > Result: > A consumer subscribed to a topic or queue: ConsumerInfo {commandId = 4, > consumerId = ID:QuangDe-PC-51000-1397993623150-1:1:1:1, destination = > topic://TOPIC2 } > A consumer subscribed to a topic or queue: ConsumerInfo {commandId = 4, > consumerId = ID:QuangDe-PC-54005-1398005456464-1:1:1:1, destination = > topic://TOPIC1} > > Code: > /public class AdvisoryTest { > static MessageListener listener = new MessageListener() { > @Override > public void onMessage(Message message) { > System.out.println("message: " + message); > if (message instanceof ActiveMQMessage) { > ActiveMQMessage activeMessage = > (ActiveMQMessage) message; > Object command = > activeMessage.getDataStructure(); > if (command instanceof ConsumerInfo) { > System.out.println("A consumer subscribed > to a topic or queue: " + > command ); > } else if (command instanceof RemoveInfo) { > RemoveInfo removeInfo = (RemoveInfo) > command; > if (removeInfo.isConsumerRemove()) { > System.out.println("A consumer > unsubscribed from a topic or > queue"+command); > } else { > > System.out.println("RemoveInfo, a connection was closed: " + command); > } > } else if (command instanceof ConnectionInfo) > { > System.out.println("ConnectionInfo, a > new connection was made: " + > command); > } else { > System.out.println("Unknown command: > " + command); > } > } > } > }; > > public static void main(String[] args) { > try { > // ActiveMQConnectionFactory connectionFactory = new > // ActiveMQConnectionFactory( > // "user", "password", > ActiveMQConnection.DEFAULT_BROKER_URL); > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = > connectionFactory.createConnection(); > Session session = connection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > connection.start(); > Destination consumerTopicAdvisoryDest = > session.createTopic("ActiveMQ.Advisory.Consumer.Topic.>"); > > MessageConsumer consumerAdvisory = > session.createConsumer(consumerTopicAdvisoryDest); > consumerAdvisory.setMessageListener(listener); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > }/ > > But when I change the destination to Topic advisoryAll = > session.createTopic("ActiveMQ.Advisory.>"). I am understanding this topic > include all of advisory messages. But I receive the result not include > "consumer subscribed". > > ActiveMQMessage {commandId = 0, messageId = > ID:QuangDe-PC-49713-1397991439530-1:1:0:0:1, producerId = > ID:QuangDe-PC-49713-1397991439530-1:1:0:0, destination = > topic://ActiveMQ.Advisory.MasterBroker} > > Although, topic "ActiveMQ.Advisory.>" still receive all event happend after > it start. I don't know why. Please help me if you know root cause > > Thanks everybody! > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Advisory-Message-not-correct-tp4680421.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. -- http://redhat.com http://blog.garytully.com