View Source MessageStore.Subscriber (message_store v3.2.0)

A subscribe server for handling messages.

options

Options

  • message_store: module - it's messages store module for access event data/streams. Required.
  • stream_name: string - it's stream name to subscribe for messages. Required.
  • handlers: module - message handlers. Required.
  • subscriber_name: string - unique name. Required.
  • origin_stream_name: string - when is set, filter messages that has in metadata same value in origin_stream_name key. Optional.
  • address: string - used for filter messages with same value in metadata recipient key. Optional.
  • event_store_name: string the name of the event store if provided to EventStore.start_link/1.
  • start_from: atom is a pointer to the first event to receive. It must be one of:
    • :origin for all events from the start of the stream (default).
    • :current for any new events appended to the stream after the subscription has been created.
    • any positive integer for a stream version to receive events after.
  • buffer_size: integer limits how many in-flight events will be sent to the subscriber process before acknowledgement of successful processing. This limits the number of messages sent to the subscriber and stops their message queue from getting filled with events. Defaults to one in-flight event.
  • transient: boolean is an optional boolean flag to create a transient subscription. By default this is set to false. If you want to create a transient subscription set this flag to true. Your subscription will not be persisted, so if the subscription is restarted, you will receive the events again starting from start_from. An example usage are short lived event handlers that keep their state in memory but still want to have the guarantee to have received all events. It's possible to create a persistent subscription with some name, stop it and later create a transient subscription with the same name. The transient subscription will now receive all events starting from start_from. If you later stop this transient subscription and start a persistent subscription again with the same name, you will receive the events again as if the transient subscription never existed.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.