I have existing code I've been using to publish/subscribe messages on topics
using ActiveMQ 5.8.0 and Java 1.7. I've been trying to use some advisories
(ActiveMQ.Advisory.MessageDelivered.Topic and
ActiveMQ.Advisory.MessageConsumed.Topic) to implement some sort of
reliability QoS policy. I have been unable to receive any advisories to this
point.  After reading the section about advisories on the ActiveMQ site as
well as poking around in the javadocs, I have tried numerous things with no
success.

What I have tried so far:

In <activeMQ install dir>/conf/activemq.xml (is this the correct file?):

In the <broker> element, I set the advisorySupport attribute to true. It was
not specified prior to this.
In the "topic" policyEntry inside the <destinationPolicy> element policyMap,
I set the advisoryForDelivery and advisoryForConsumed attributes to true.
They weren't specified prior to this.

I'm not sure what the defaults are for these items, so I figured I'd turn
them on.

On my connection factory, I called setWatchTopicAdvisories(true).

When I created my Session, I set the acknowledge to
Session.CLIENT_ACKNOWLEDGE (I originally had Session.AUTO_ACKNOWLEDGE). The
session is also non-persistent.

In my subscriber, I called acknowledge() on messages received either by
receive() or by a registered MessageListener. I assume this is necessary for
the "consumed" advisory to be sent. What would need to be done to generate
other message transmission related advisories?

In my publisher (I haven't yet implemented any advisory logic in the
subscriber), I do the following:
      Destination msgConsumedAdvisory =
AdvisorySupport.getMessageConsumedAdvisoryTopic(destination);
      MessageConsumer advisoryConsumer =
session.createConsumer(msgConsumedAdvisory);
      advisoryConsumer.setMessageListener(new MessageListener());
where MessageListener is a private class that implements
javax.jms.MessageListener.

When I run programs that launch a publisher and subscriber, the onMessage()
of the MessageListener registered above is never called. In the meantime,
the messages are successfully being sent and received.

Thanks.




--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Cannot-get-Advisory-to-work-tp4692103.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to