This library allows you to write simple JMS applications using https://micronaut.io/ and IBM MQ
The micronaut-jms-mq
library requires configuration telling micronaut where the MQ servers are:
mq-server:
ibm-mq:
host: "${mq.server:localhost}"
port: "${mq.port:1414}"
queueManager: QM1
channel: DEV.ADMIN.SVRCONN
username: admin
password: passw0rd
To send messages you simply need to create a client interface:
@JmsClient("ibm-mq")
public interface MessageService {
@JmsDestination(value = "///DEV.QUEUE.MESSAGE")
@JmsReplyDestination(value = "///DEV.QUEUE.REPLY", timeout = 5_000)
String sendMessage(String text);
}
To listen to messages you create a listener interface:
@Infrastructure
@JmsListener("ibm-mq")
public class MessageServiceListener {
private static Logger logger = LoggerFactory.getLogger(MessageServiceListener.class);
@JmsDestination("///DEV.QUEUE.MESSAGE")
public String handleMessage(@Body String text) {
logger.info("message received {}", text);
return text;
}
}
- Simple JMS Client annotations allow you to create an interface for sending messages
- Includes support for topics
- Includes support for send/receive style messaging
- Simple JMS Listener annotations allow you to create a bean that receives messages from MQ
- Uses docker-compose to start the application.
- Add an example using Topics
- Simple chat client using Server Send Events (SSE)
- Add support for different message types
- Add @Transactional support
- Richard Allwood - Initial Version
This product is licensed under the MIT License
The project was inspired from the Micronaut RabbitMQ project