Skip to content

Commit 61c9296

Browse files
committed
Mention publishers cannot share the same name with dedup
1 parent 28bd54d commit 61c9296

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/docs/asciidoc/api.adoc

+17-13
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,23 @@ message will be persisted twice.
575575
Luckily RabbitMQ Stream can detect and filter out duplicated messages, based
576576
on 2 client-side elements: the _producer name_ and the _message publishing ID_.
577577

578+
[[deduplication-multithreading]]
579+
[WARNING]
580+
.Only one publisher instance with a given name and no multithreading to guarantee deduplication
581+
====
582+
We'll see below that deduplication works using a strictly increasing sequence for messages.
583+
This means messages must be published in order, so there must be only _one publisher instance with a given name_ and this instance must publish messages _within a single thread_.
584+
585+
With several publisher instances with the same name, one instance can be "ahead" of the others for the sequence ID: if it publishes a message with sequence ID 100, any message from any instance with a smaller lower sequence ID will be filtered out.
586+
587+
If there is only one publisher instance with a given name, it should publish messages in a single thread.
588+
Even if messages are _created_ in order, with the proper sequence ID, they can get out of order if they are published in several threads, e.g. message 5 can be _published_ before message 2.
589+
The deduplication mechanism will then filter out message 2 in this case.
590+
591+
You have to be very careful about the way your applications publish messages when deduplication is in use: make sure publisher instances do not share the same name and use only a single thread.
592+
If you worry about performance, note it is possible to publish hundreds of thousands of messages in a single thread with RabbitMQ Stream.
593+
====
594+
578595
[WARNING]
579596
.Deduplication is not guaranteed when using sub-entries batching
580597
====
@@ -585,19 +602,6 @@ batching messages in a single publish frame, which can already provide
585602
very high throughput.
586603
====
587604

588-
[[deduplication-multithreading]]
589-
[WARNING]
590-
.Deduplication is not guaranteed when publishing on several threads
591-
====
592-
We'll see below that deduplication works using a strictly increasing sequence for messages.
593-
This means messages must be published in order and the preferred way to do this is usually _within a single thread_.
594-
Even if messages are _created_ in order, with the proper sequence ID, if they are published in several threads, they can get out of order, e.g. message 5 can be _published_ before message 2.
595-
The deduplication mechanism will then filter out message 2 in this case.
596-
597-
So you have to be very careful about the way your applications publish messages when deduplication is in use.
598-
If you worry about performance, note it is possible to publish hundreds of thousands of messages in a single thread with RabbitMQ Stream.
599-
====
600-
601605
===== Setting the Name of a Producer
602606

603607
The producer name is set when creating the producer instance, which automatically

0 commit comments

Comments
 (0)