lapin v0.1.1 Lapin.Worker behaviour
Lapin Worker behaviour
To Implement a custom Lapin.Worker behaviour define a module:
defmodule MyApp.MyWorker do
use Lapin.Worker
[... callbacks implementation ...]
end
A custom Lapin.Pattern module can be specified using the pattern option:
defmodule MyApp.MyWorker do
use Lapin.Worker, pattern: MyApp.MyPattern
[... callbacks implementation ...]
end
Check out the Lapin.Pattern submodules for a number of implementantions of
common interaction patterns.
Link to this section Summary
Types
Exchange name
Worker module callback result
Module conforming to Lapin.Pattern
Queue name
Channel role
Callbacks
Called when receiving a basic.cancel from the broker
Called when receiving a basic.cancel_ok from the broker
Called when receiving a basic.consume_ok from the broker
Called when receiving a basic.deliver from the broker
Called when completing a basic.publish with the broker
Called when receiving a basic.return from the broker
Returns the pattern for the worker module, defaults to Lapin.Pattern
Link to this section Types
Exchange name
Worker module callback result
Module conforming to Lapin.Pattern
Queue name
Channel role
Link to this section Callbacks
handle_cancel(channel_config :: Lapin.Connection.channel_config) :: on_callback
Called when receiving a basic.cancel from the broker.
handle_cancel_ok(channel_config :: Lapin.Connection.channel_config) :: on_callback
Called when receiving a basic.cancel_ok from the broker.
handle_consume_ok(channel_config :: Lapin.Connection.channel_config) :: on_callback
Called when receiving a basic.consume_ok from the broker.
This signals successul registration as a consumer.
handle_deliver(channel_config :: Lapin.Connection.channel_config, message :: Lapin.Message.t) :: on_callback
Called when receiving a basic.deliver from the broker.
Message consumption is successfully completed when this callback returns :ok
handle_publish(channel_config :: Lapin.Connection.channel_config, message :: Lapin.Message.t) :: on_callback
Called when completing a basic.publish with the broker.
Message transmission to the broker is successful when this callback is called.
handle_return(channel_config :: Lapin.Connection.channel_config, message :: Lapin.Message.t) :: on_callback
Called when receiving a basic.return from the broker.
THis signals an undeliverable returned message from the broker.
Returns the pattern for the worker module, defaults to Lapin.Pattern