Add PublishWithAck documentation #7665
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PublishWithAck
A
PublishWithAckenvelope message works just like a normalPublishenvelope, but unlike normalPublishmessage, aPublishWithAckhas an extraTimeoutproperty and, if failed to be published, will be stored inside a per-topic buffer to wait until a subscriber in the cluster subscribed to the topic.Buffer
PublishWithAckmessage and able to deliver it immediately, it will send back aPublishSucceededmessage back to the original sender as a signal.PublishWithAckmessage, it will store the message inside a buffer.akka.cluster.pub-sub.buffered-messages.max-per-topicBuffer timeout
PublishWithAckmessage contains theTimeoutproperty.akka.cluster.pub-sub.buffered-messages.timeout-check-intervaltime, the mediator will scan through all the buffered message to check and see if it has been sitting in the buffer for more than timeout period.PublishFailuremessage will also be sent to the original sender to signal publish failures.Buffer delivery
When any subscribers of the same topic as the
PublishWithAcktopic joins the publisher node, all buffered messages will be sent to the subscriber. For each delivered message, the mediator will send aPublishSucceededmessage to the original sender as a signal.Buffer overflow
When a new message is inserted and the topic buffer count exceeds
akka.cluster.pub-sub.buffered-messages.max-per-topic, the mediator will discard the oldest message in the buffer and send aPublishFailedto the original sender of that message.Example
This example is the same as the publisher example above, but now it uses
PublishWithAckand it will wait for 30 minutes for the payload to be consumed.