-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
67 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defmodule Amqpx.NoSignalHandler do | ||
@moduledoc """ | ||
Dummy signal handler module that does handle the graceful termination. | ||
""" | ||
|
||
@behaviour Amqpx.SignalHandler | ||
|
||
@impl true | ||
def draining?, do: false | ||
|
||
@impl true | ||
def stopping?, do: false | ||
|
||
end |
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,20 @@ | ||
defmodule Amqpx.SignalHandler do | ||
@moduledoc """ | ||
Signal handler behaviour is used to catch the SIGTERM signal and gracefully stop the application. | ||
In the context of Rabbitmq, it will: | ||
cancel the channel when we are in draining mode to stop prefetch new messages. | ||
close the channel when we are in stopping mode to reject all the unacked messages that we did't start to consume. | ||
Check in Peano how to use it. | ||
""" | ||
@doc """ | ||
Check if the application is in draining mode. | ||
""" | ||
@callback draining? :: boolean | ||
|
||
@doc """ | ||
Check if the application is in stopping mode. | ||
""" | ||
@callback stopping? :: boolean | ||
end |