I'm trying to get advisory messages to work in an ActiveMQ server and
I'm not having any luck.  I'm using a Spring container that is already
successfully interacting with non-advisory queues on the ActiveMQ
server.  I use Spring to add a listener for consumed messages on a queue
like this:

  <bean
class="org.springframework.jms.listener.DefaultMessageListenerContainer"
>
    <property name="connectionFactory" ref="connectionFactory"/>
    <property name="destinationName">
      <value>ActiveMQ.Advisory.MessageConsumed.Queue.MYQUEUE</value>
    </property>
    <property name="messageListener">
      <bean class="testing.MyClass">
        <property name="responseTemplate" ref="anotherJmsTemplate"/>
      </bean>
    </property>
    <property name="sessionTransacted" value="true"/>
  </bean>

I've also tried removing the sessionTransacted property, and setting it
to false.

In the activemq server configuration, I've updated the destination
polcy:

        <destinationPolicy>
            <policyMap>
                <policyEntries>
                    <policyEntry queue=">" memoryLimit="5mb"/>
                    <policyEntry topic=">" memoryLimit="5mb"/>
                    <policyEntry queue="MYQUEUE"
advisoryForConsumed="true"/>
                </policyEntries>
            </policyMap>
        </destinationPolicy>

I've also tried:

        <destinationPolicy>
            <policyMap>
                <policyEntries>
                    <policyEntry queue=">" memoryLimit="5mb"
advisoryForConsumed="true"/>
                    <policyEntry topic=">" memoryLimit="5mb"/>
                </policyEntries>
            </policyMap>
        </destinationPolicy>

And just for completeness, after all of this failed, I tried adding
advisorySupport="true" to the broker element in the configuration.

When I run tests, I can see in the ActiveMQ HTTP interface that a
message was sent to and received from the MYQUEUE queue, and I can see
that there is a consumer on
ActiveMQ.Advisory.MessageConsumed.Queue.MYQUEUE.  However, at no time is
my onMessage callback on the MessageListener run, nor do I see any
messages sent or received on the
ActiveMQ.Advisory.MessageConsumed.Queue.MYQUEUE queue in the server HTTP
interface.

As a final test, I tried switching my advisory queue listener to
ActiveMQ.Advisory.Connection, a topic that is supposed to be enabled by
default.  I can see in the HTTP monitor that the topic has a consumer,
but I still get no messages, and the monitor shows that no messages
where sent, even though I had programs connecting, sending messages and
disconnecting.

Finally, if I disable the regular consumer on MYQUEUE and edit the
destinationName of the advisory listener to listen to MYQUEUE directly,
it does get called, so its not a problem with the listener
implementation.

Why isn't this working?

Thanks
Chris

Reply via email to