You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/asciidoc/api.adoc
+17-13
Original file line number
Diff line number
Diff line change
@@ -575,6 +575,23 @@ message will be persisted twice.
575
575
Luckily RabbitMQ Stream can detect and filter out duplicated messages, based
576
576
on 2 client-side elements: the _producer name_ and the _message publishing ID_.
577
577
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
+
578
595
[WARNING]
579
596
.Deduplication is not guaranteed when using sub-entries batching
580
597
====
@@ -585,19 +602,6 @@ batching messages in a single publish frame, which can already provide
585
602
very high throughput.
586
603
====
587
604
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
-
601
605
===== Setting the Name of a Producer
602
606
603
607
The producer name is set when creating the producer instance, which automatically
0 commit comments