Posts

Showing posts from August, 2012

Writing Unit Tests to test JMS Queue listener code with ActiveMQ

During my GSoC project for OpenNMS i did some work with JMS and wanted to write test classes to make sure that my code was working well. In this article i will try to explain how you can use ActiveMQ to write test cases for your JMS code. This is very handy when your code has a part that listens to a JMS queue.

Apache ActiveMQ 

Apache ActiveMQ is a extremely popular and very powerful open source messaging and Integration Patterns server. You can check it out here. The part we will be using to run our test classes is the embedded broker that is provided by ActiveMQ. This allows you to create a temporary broker for test purposes to create a JMS queue in our case. If you want to learn more about the embedded broker check out this article. The easiet way to create a embedded broker is through the following code line. This will automatically create a embedded broker.
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
Code…

Setting up a ZooKeeper Quorum on Amazon EC2 with Exhibitor

Image
Hi in this post i will try to explain step by step how to set up a ZooKeeper Quorum in Amazon EC2 with the help of Exhibitor. This was done as a part of my final year project so i thought i should share this because it might be helpful to others. I assume that you know about ZooKeeper otherwise you want be reading this article right. anyway if you want to learn about ZooKeeper you can check out the ZooKeeper home page here.

Exhibitor

So i will first introduce you to Exhibitor its actually a supervisory system that is built using java technology to monitor and supervise ZooKeeper. It provides some cool features that will help you manage your ZooKeeper instances. You can download Exhibitor here. And if you want to learn more about Exhibitor take a look at there wiki page here. Exhibitor allows you to configure ZooKeeper instances through a very clean web interface. the config panel will look like this.


As you can see you can define the data dir and the ZooKeeper installation dir. lets t…