0
votes

I'm using a non durable topic with a simple producer and consumer in ActiveMQ. The producer sometimes can be idle, not sending any messages.

I want to detect this (no messages in the topic) on the consumer side and inform the user.

How do I do this? Cant find any information on this.

Thanks Amit

1

1 Answers

1
votes

The consumer subscribes to the topic. If the consumer is not receiving any messages then that means the producer is idle. Unlike queues, messages in topics are transient by nature (ignoring the details of durable subscriptions).

Have your consumer update a timestamp everytime a message is received from the topic. Also, have a seperate thread that periodically monitors the timestamp to inform the user if the timestamp is older than X milliseconds.