-
1. Re: MQ & Triggers
bsnyder May 27, 2008 2:33 PM (in response to swampcritter)My question is 'Can Active MQ be setup to use triggers' -- i.e. when a message is sent by a remote client interface to the MQ broker, can the local queue/topic discover the inbound message and trigger an outside process that can dump the message from the queue (or topic)?
You could certainly achieve this by creating a class that implements the JMS MessageListener so that every time a message arrives on a queue, some action is taken. Inside of class, you are free to do whatever is necessary. The whole point is that this type of event processing can be achieved using a MessageListener. You'd just have to implement the custom functionality.
Bruce
-
2. Re: MQ & Triggers
swampcritter May 28, 2008 11:55 AM (in response to bsnyder)I found this sample Java program...
http://www-304.ibm.com/jct09002c/isv/tech/sample_code/mq/JavaTrigger.java
It seems to be more for IBM's Webspehere MQ. Could it be modified for Active MQ needs?
A number of Websphere MQ Java samples:
-
3. Re: MQ & Triggers
ccustine May 28, 2008 12:40 PM (in response to swampcritter)I would suggest taking a look at Fuse Mediation Router / Apache Camel for your scenario. You can find information about how to configure Camel inside of ActiveMQ here. Basically you can configure camel to watch for a message on a queue and then route to one of the built in Camel components for transferring files (full list here). For example, you could take the contents of a message from a queue and save to a local file, use ftp, sftp, and several other options.
If you need more flexibility in configuring the file transfers (dynamic destinations, based on content, etc.) then you may have to get more crafty, but I am fairly certain that Camel going to get you pretty close to you solution.
Chris