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: lib/producer/producer.ex
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ defmodule RabbitMQStream.Producer do
34
34
The RabbitMQStream.Producer accepts the following options:
35
35
36
36
* `:stream_name` - The name of the stream to publish to. Required.
37
-
* `:reference_name` - The string which is used by the server to prevent [Duplicate Message](https://blog.rabbitmq.com/posts/2021/07/rabbitmq-streams-message-deduplication/). Defaults to `__MODULE__.Producer`.
37
+
* `:reference_name` - The string which is used by the server to prevent [Duplicate Message](https://blog.rabbitmq.com/posts/2021/07/rabbitmq-streams-message-deduplication/). Defaults to `__MODULE__.Producer`. (If clustering in production, check notes and the end.)
38
38
* `:connection` - The identifier for a `RabbitMQStream.Connection`.
39
39
* `:serializer` - The module to use to decode the message. Defaults to `nil`, which means no encoding is done.
40
40
@@ -111,6 +111,17 @@ defmodule RabbitMQStream.Producer do
111
111
The default value for the `:serializer` is the module itself, unless a default is defined at a higher level of the
112
112
configuration. If there is a `encode!/1` callback defined, it is always used
113
113
114
+
# Notes on Clustering
115
+
116
+
Be aware that the sequence tracking for each `:reference_name` is global. Meaning the if you are running
117
+
your Elixir as a cluster of multiple nodes, and each having a process of a Producer with the same
118
+
`:reference_name`, you may encounter issues with message de-duplication, where messages are being
119
+
dropped because the sequence on each producer's state might not be up to date after another process
120
+
with the same `:reference_name` produced a message.
121
+
122
+
There might be cases where you would want this behaviour. If not, be sure to declare a unique
0 commit comments