Intercepting, modifying and forwarding ActiveMQ message traffic
I’ll preface this with the fact that I am very new to Camel. I’ve read some of the online information and some of the “Camel In Action” book. I’ve been able to get very basic routes to work successfully.
I am writing an application whose job is to “fuzz” messages sent from one service to another. The intent is to gauge how the “service bus” reacts to what is being sent. The service bus provides flexibility in the transports and message formats which can be used. There is an XML schema that defines all the message types. Basic implementations use XML over ActiveMQ using the topic publish/subscribe method, but other options are possible.
For this situation, fuzzing means that I will replace the valid content of a message field or attribute with non-valid content. The schema is used, in part, to define what would be invalid. Other more general invalid values may also be used (e.g. value > Integer.MAX for an integer type field).
What I need to do is send a message via the service bus, capture what is sent (different transports, different wire formats – though not in the same execution), apply the “fuzz” to a selected field and forward the modified message on to its intended destination. This process is repeated many times for different test scenarios until all of the message fields have been tested for a given message type.
It was very easy to write a small program to create a route that captures the ActiveMQ traffic and dumps information about what is passing. This is well and good, but I need to do more.
I’m having a little difficulty understanding how routing works in the ActiveMQ (or any MOM) case. You set up a “from” to consume AMQ traffic and then add a “to” to route the traffic to. I would think my fuzzing logic would sit in that route chain (probably as a Processor). I also don’t understand how to indicate that AMQ is also the terminal “to” endpoint, so that the fuzzed message gets sent to the subscriber. Do I need to instead create a proxy that the producer will connect to and then the proxy connects to the AMQ “endpoint”?
I’m not sure what would be the better technique to apply to achieve what I’ve described. If anyone has suggestions, I would greatly appreciate it.