0
votes

I am developing an application in which I have jms message queue.

There is a producer which enqueue message to the queue and a consumer to dequeue the message.

There might be cases when consumer is not running. If a message is not consumed by the consumer within a certain amount of time I need to catch that from producer.

I want to use JMX to monitor message queue's message whether it is expired.

Any suggestion or sample code how to this.....

1

1 Answers

0
votes

It depends on the JMX implementer... Some servers provide JMX implementations to monitor its resources. If its not provided, then you will need to write the JMX implementation that uses the API provided by the MQ implementer.

An easier way to solve this problem is to use the request-response pattern with expiry. The consumer needs to respond in a specified internal of time. If it can't then the message on the queue can expire. If the response is not received the producer can take further action. JMS selector with correlation ID can be used to relate the responses with the request.