Mississippi.Consumer.DataUpdater behaviour (Mississippi v1.0.0)

View Source

The DataUpdater process takes care of handling messages and signals for a given sharding key. Messages are handled using the message_handler providedin the Mississippi config, which is a module implementing DataUpdater.Handler behaviour. Note that the DataUpdater process has no concept of message ordering, as it is the MessageTracker process that takes care of maitaining the order of messages.

Summary

Functions

Returns a specification to start this module under a supervisor.

Provides a reference to the DataUpdater process that will handle the set of messages identified by the given sharding key.

Handle a message using the message_handler provided in the Mississippi config (which is a module implementing DataUpdater.Handler behaviour). You can get the DataUpdater instance for a given sharding_key using get_data_updater_process/1.

Handles an information that must be forwarded to a message_handler but is not a Mississippi message. Used to change the state of a stateful Handler. The call is blocking and there is no ordering guarantee. You can get the DataUpdater instance for a given sharding_key using get_data_updater_process/1.

Callbacks

get_data_updater_process(sharding_key)

@callback get_data_updater_process(sharding_key :: term()) ::
  {:ok, pid()} | {:error, :data_updater_start_fail}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_data_updater_process(sharding_key)

@spec get_data_updater_process(sharding_key :: term()) ::
  {:ok, pid()} | {:error, :data_updater_start_fail}

Provides a reference to the DataUpdater process that will handle the set of messages identified by the given sharding key.

handle_message(data_updater_pid, message)

Handle a message using the message_handler provided in the Mississippi config (which is a module implementing DataUpdater.Handler behaviour). You can get the DataUpdater instance for a given sharding_key using get_data_updater_process/1.

handle_signal(data_updater_pid, signal)

Handles an information that must be forwarded to a message_handler but is not a Mississippi message. Used to change the state of a stateful Handler. The call is blocking and there is no ordering guarantee. You can get the DataUpdater instance for a given sharding_key using get_data_updater_process/1.

start_link(extra_args, start_args)