This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support publisher confirmations (#110)
[Publisher confirmations](https://www.rabbitmq.com/confirms.html#publisher-confirms), is a mechanism to ensure that a published message actually reached a broker. Extend, publisher configuration with two optional attributes: * `activate_confirmations` - when set to `true`, confirmations will be activated on the channel during publisher setup + confirmation will be awaited on every publish * `max_confirmation_wait_time` - maximum time in seconds, that publisher will wait for a confirmation from a broker before timeouting
- Loading branch information
Showing
3 changed files
with
93 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
defmodule TestPublisher do | ||
defmodule Default do | ||
@moduledoc false | ||
@behaviour GenRMQ.Publisher | ||
|
||
def init() do | ||
[ | ||
exchange: "gen_rmq_out_exchange", | ||
uri: "amqp://guest:guest@localhost:5672", | ||
app_id: :my_app_id | ||
] | ||
end | ||
end | ||
|
||
defmodule WithConfirmations do | ||
@moduledoc false | ||
@behaviour GenRMQ.Publisher | ||
|
||
def init() do | ||
[ | ||
exchange: "gen_rmq_out_exchange", | ||
uri: "amqp://guest:guest@localhost:5672", | ||
app_id: :my_app_id, | ||
enable_confirmations: true | ||
] | ||
end | ||
end | ||
end |