Reputation: 3644
So I got my ActiveMQ to receive messages from another location woo hoo - happy dance going on here this morning!
Now I need to take subsequent steps on the messages once they arrive in the queue.
Specifically, depending on the file name, it will need to be sent to another queue or directly to another process if that can happen.
For instance, a one file is sent that contains information about changes to a court session. I need to read that XML and update some local MySQL tables. Could the court session process be a webservice? ideally I would like to just pass along the file to that service.
Another file is sent that contains information about a cancelled warrant, I need to send information from that file to a stored procedured on an external Oracle database. I can tell from the file name what the next process is that the file should be sent to.
So, I am looking for suggestions on what would my best course of action is to set up the additional processing for the files that are being sent to our queue?
Thanks a bunch!!! BTW - We have already ordered 'ActiveMQ in Action' and 'Camel in Action' and I will be reading those but for right now, any specific newbie guidance will be greatly appreciated.
leslie
Upvotes: 1
Views: 776
Reputation: 21005
Camel's content based router is what you are looking for. It allows you to setup routing rules based on the message body/headers/properties...
Here is a basic example that reads from an inbound queue and simply delegates to other queues based on headers...
from("activemq:queue:inboundQueue")
.choice()
.when(header("foo").isEqualTo("bar"))
.to("activemq:queue:barQueue")
.when(header("foo").isEqualTo("cheese"))
.to("activemq:queue:cheeseQueue")
.otherwise()
.to("activemq:queue:generalQueue");
In addition to checking message headers, you can also check the body and properties (using simple expressions, xpath, etc) to determine proper routing, etc...
Upvotes: 2