I would use ActiveMQ lib and Spring JMS, here is a usage example
start broker
BrokerService broker = new BrokerService();
broker.addConnector("tcp://localhost:61616");
broker.start();
read msg
ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
JmsTemplate t = new JmsTemplate(cf);
Message msg = t.receive();
send message
ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
JmsTemplate t = new JmsTemplate(cf);
t.send("test", new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("test");
}
});