This message was deleted.
# general
s
This message was deleted.
d
Pulsar consumers use an internal queue to storage messages it retrieves from the data serving layer (brokers). When a consumer first subscribes to a topic, a request is sent to the broker to fetch N messages from the topic. The broker uses the subscription name to determine which messages are “next” to be process and then sends N messages to the consumer, when N = the size of the internal buffer.
The consumer then “feeds” these messages to the application that is running the consumer, via the
receive
method*.* After the application has processed the message, it needs to acknowledge the successful processing of the message via the
acknowledge
method*.*
The call to the acknowledge, results in an different message getting sent back to the broker to let it know that it can update the cursor position on the subscription so that the message isn’t redelivered. Upon receipt of the ACK message from the client the broker attempts to update the cursor position, and if it is successful, sends another message back to the consumer acknowledging the ACK was received and processed.
When the client gets the ACK ACK back, it now knows it is safe to remove the message from the internal queue. This process repeats until the message queue drops below the 1/2 full mark, e.g. when 500 of the first 1000 messages are processed. When that level is reached, the consumer sends another request to the broker asking for 500 new messages to replenish its internal buffer.
👏 1