OffBroadway.EMQTT.MessageHandler behaviour (off_broadway_emqtt v0.2.0)

View Source

Behaviour for handling messages received from the MQTT broker. Custom message handlers can be implemented by defining a module that implements this behaviour.

Summary

Callbacks

Callback invoked after a successful connection to the MQTT broker.

Callback invoked after a disconnect from the MQTT broker.

Messages are passed to this function after the producer has received them from the MQTT broker.

PUBREL messages received from the MQTT broker are passed to this function.

Types

broadway()

@type broadway() :: atom() | {:via, module(), term()}

message()

@type message() :: term()

reason_code()

@type reason_code() :: term()

Callbacks

handle_connect(properties)

@callback handle_connect(properties :: term()) :: any() | mfa()

Callback invoked after a successful connection to the MQTT broker.

handle_disconnect(arg1)

@callback handle_disconnect({reason :: reason_code(), properties :: term()} | atom()) ::
  any() | mfa()

Callback invoked after a disconnect from the MQTT broker.

handle_message(message, broadway, opts)

@callback handle_message(message :: message(), broadway :: broadway(), opts :: keyword()) ::
  any() | mfa()

Messages are passed to this function after the producer has received them from the MQTT broker.

handle_pubrel(pubrel)

@callback handle_pubrel(pubrel :: map()) :: any() | mfa()

PUBREL messages received from the MQTT broker are passed to this function.

Functions

ack_message(message, ack_options)

handle_connect(properties)

handle_disconnect(reason)

handle_message(message, broadway, opts)

handle_pubrel(pubrel)