Here the pattern of consumer-producer
Producer
creates a new message, consumer
listens for them via Broker
.
So far, producer
creates and sends a message while consumer
waits for message. When new message comes consumer
prints it to the screen.
I want Producer
to be informed that Consumer
has received the message and dequeued it.
I wonder is there any way to notify/feedack Producer
from Consumer
? Or should I inform Consumer
via Broker
? How can do it?
The JMS standard supports a Reply Queue (JMSReplyTo), so that the original consumer can return a reply message to the original producer on the specific queue.
As shown here;
http://www.enterpriseintegrationpatterns.com/patterns/messaging/RequestReplyJmsExample.html
If you also use the JMSCorrelationID, then you can link the messages together, so that you know the reply relates to the specific request with id xxxxx.
Of coruse this then means the the consumer will become a producer for the reply message.
The link provided also has code to show a working example (although I have not tried it myself)