0
votes

I read following quote from ActiveMQ documentation here:

The downside to using synchronous message delivery is that the producer is more likely to block if there is a slow consumer that he is dispatching messages to.

But I don't understand how the producers, in general, can be blocked because of slow consumer, because my understanding is that a JMS client (producer) will send a message to a queue of a ActiveMQ instance (broker) and that's it, now producer is free or in other words producer thread which sent the message is free to complete/die. Then there will be some other JMS clients (consumers) listening for that queue, now as soon as message arrives to the broker, broker will send it to the listening consumers.

Now, in all this where producer is dependent upon consumer?

1

1 Answers

4
votes

When a producer send a persistent message to the broker the broker must write that message to disk before sending back an acknowledge to the producer to let it know what it's message is safely stored away for later dispatch to a consumer. In the case of a slow consumer the producer might eventually run into a case where the broker has reached a resource limit and cannot store that message either on the Queue in memory or on disk, it all depends on the broker's configuration.

The the producer isn't so much tied to the consumer as it is to the resources on the broker needed to hold the message until it has been consumed.