I was wondering if I could use the Coldfusion example ActiveMQ event gateway to subscribe to multiple topics.
Currently I can set
destinationName=dynamicTopics/topic1
however I would have assumed I could set some kind of Composite Destination
destinationName=dynamicTopics/topic1,topic2
or
destinationName=dynamicTopics/topic1,dynamicTopics/topic2
This does not seem to work. Is this just not possible out of the box, or am I missing something about how JNDI works?
Obviously the alternative is creating multiple event gateways, but I do not like that idea at all.
Also it would be important to have access to the incoming message's topic's name in the onIncomingMessage handler
The way that I accommodate multiple destinations in a single ActiveMQ event gateway is to use an "action" as my qualifier. Rather than have multiple queues or topics, I instead include the target in my payload like:
Then in onIncomingMessage, I fork based on the action:
And I use private methods to implement each of the routines as needed. A bonus of pulling the code out of onIncomingMessage, it can be implemented in a standalone CFC which can be unit tested on its own using something like MxUnit or TestBox.