There will be several situations in which the application may not always be ready to consume messages. In such situations, the application would like to reach a state of readiness before it starts consuming messages. In such situations, the polling consumer pattern becomes very helpful. The diagram of a polling consumer pattern is depicted as follows:
In this pattern, the application uses a polling consumer, which makes a call as and when it is ready to receive a message. The polling consumer is also known as a synchronous receiver. This is because the receiver thread is in a blocked state until a message is received. Most of the messaging APIs provide a receive method, which blocks until a message is delivered.