Stargate.Receiver.MessageHandler behaviour (stargate v0.2.0) View Source

Defines the MessageHandler behaviour required by a module passed to a Stargate reader or consumer.

A message handler must implement a handle_message/1 for stateless message processing, and for stateful processing, a handle_message/2 and an init/1 function.

This module also defines a __using__ macro to pull default implementations of these functions into your module as well as getter functions for the topic-aware data stored in the process dictionary of the Processor stage calling the message handler.

Link to this section Summary

Functions

Provides a macro for implementing the behaviour in the client application's message handler module and automatically pull in default implementations of the required functions and getters for the data stored in the processor stage's process dictionary.

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

Provides a macro for implementing the behaviour in the client application's message handler module and automatically pull in default implementations of the required functions and getters for the data stored in the processor stage's process dictionary.

Link to this section Callbacks

Specs

handle_message(term()) :: :ack | :continue
Link to this callback

handle_message(term, term)

View Source

Specs

handle_message(term(), term()) :: {:ack, term()} | {:continue, term()}

Specs

init(term()) :: {:ok, term()}