Question

I have a java application that is consuming from one JMS queue, doing some processing, and then sending to an output queue.

While I'm testing, it'd be very handy to have a filesystem based JMS implementation for the output queue; such that any messages sent to it would just be written to a directory on disk.

Does anyone know if this exists? I've considered switching to an integration framework like apache-camel which has file based endpoints, but seems overkill for what I need right now. I'm using activemq, is it possible to configure an embedded broker to do this?

Was it helpful?

Solution

I would go for apache camel anyhow. It also saves you quite some boilerplate code to connect to activemq. If you are also using spring already its just a matter of adding a simple routebuilder and some xml configuration. The jars themselves are rather small so its a rather small bit of overhead to pay in return of a big amount of flexibility.

OTHER TIPS

I think this approach of testing your jms related client code can get very complicated. If you need to spy on which messages where send from your application, consider using a QueueBrowser.

However, the code that receives the messages must have some sort of side effects (otherwise, it would not be useful). I would base the assertions on these rather then inspecting the message queues. This should be much easier and will most likely result in better tests.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top