Testing RabbitMQ and Spring Integration

I am developing an application with Spring Integration and RabbitMq and I am wondering how to test it (integration tests).

I think SoapUI might be a great solution, but it doesn't support RAbbitMq, hermesjms.com has support for Qpid, so I thought it might be easy to make a new plugin to support Rabbitmq, but it's more complicated than I thought to the project is a little old and has a bunch of dependencies. So I start thinking about doing something myself, like a DSL in python, something like this:

tests = [{ 'name': 'start',
    'routing_key': 'returned',
    'payload' : "xxxxx",
    'timeOut' : '10000',
    'expected': '',
    'threads': '1'
},
{ 'name': 'second',.....
]

      

And then with Pika follow the steps and check the results.

I know this is very silly and the sopaui is huge and awesome, but at least it will allow me to do small tests.

What would you recommend?

+3


source to share


3 answers


RabbitMQ provides you with Webfrontend (aka control view 1 ).

So: What exactly do you want to test? Let's say you want to check that the incoming message on requestChannel is down to the service and back, you can just auto-feed the channel directly (i.e. @Autowired private Channel requestChannel;) and put the message in it.

However, only if you configure your architecture correctly: every step of your process can be tested using mockups or custom modified dependencies.



In addition to your own components, this check applies to spring components (frontends). Let's say you are implementing your own router: check and validate input and output. The same goes for the transformer.

If you try to test the bi-picture, you have to rebuild the complete script. But it doesn't have to be that complicated with fickle and short-lived queues and messages.

Is there anything else you want to check?

+1


source


For rabbitMq, my advice is to use real RabbiMQ: this can be done by using Vagrant with chef to provide RabbitMq and Vagrant maven plugin to start Box before testing the integration and stop it in the integration tests post-fact

Vagrant Maven Plugin: http://nicoulaj.github.io/vagrant-maven-plugin/

Vagrant WebSite: http://www.vagrantup.com/

Chef Chef for RabbitMQ: https://github.com/opscode-cookbooks/rabbitmq



To summarize, you must:

  • Install the vagrant and create an empty box (Centos or Ubunutu).
  • provide the VM with rabbitMQ cookbook.
  • put the .box in your home folder (rabbitMQ.box).
  • Configure your maven project to run a vagrant up VM (~ / rabbitMQ.box) in the pre-phase of integration tests.
  • Configure your maven project to stop the virtual machine with the firewall stop (~ / rabbitMQ.box) in the pre-phase of the integration tests.

Hope this help

0


source


RabbitMQ now has an HTTP API, so you can use it instead of JMS

http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v2_8_4/priv/www/api/index.html

0


source







All Articles