Routemaster Client v0.3.0 Routemaster.Publisher View Source

Publishes events to the event bus.

Link to this section Summary

Functions

Shortcut function to publish create events

Shortcut function to publish delete events

Shortcut function to publish noop events

Shortcut function to publish update events

Link to this section Types

Link to this type http_status() View Source
http_status() :: non_neg_integer()

Link to this section Functions

Link to this function create(topic, url, options \\ []) View Source
create(binary(), binary(), Keyword.t()) :: :ok | {:error, http_status()}

Shortcut function to publish create events.

See Routemaster.Publisher.send_event/4 for details on the arguments and options.

Link to this function delete(topic, url, options \\ []) View Source
delete(binary(), binary(), Keyword.t()) :: :ok | {:error, http_status()}

Shortcut function to publish delete events.

See Routemaster.Publisher.send_event/4 for details on the arguments and options.

Link to this function noop(topic, url, options \\ []) View Source
noop(binary(), binary(), Keyword.t()) :: :ok | {:error, http_status()}

Shortcut function to publish noop events.

See Routemaster.Publisher.send_event/4 for details on the arguments and options.

Link to this function send_event(topic, event, url, options \\ [timestamp: nil, data: nil, async: nil]) View Source
send_event(binary(), binary(), binary(), Keyword.t()) ::
  :ok | {:error, http_status()}

Publishes an event to the bus.

Arguments:

  • topic: the topic to which the event should be published.
  • event: the event type, must be one of the canonical types: create, update, delete, noop.
  • url: a HTTPS URL at which the resource of the event can be retrieved.
  • options, an optional keyword list with:

    • timestamp: an integer unix timestamp.
    • data: any extra payload for the event, must be serializable as JSON.
    • async: whether the event should be published in a supervised background Task.
Link to this function update(topic, url, options \\ []) View Source
update(binary(), binary(), Keyword.t()) :: :ok | {:error, http_status()}

Shortcut function to publish update events.

See Routemaster.Publisher.send_event/4 for details on the arguments and options.