ExIhdlSubscriptionBase v1.2.0 ExIhdlSubscriptionBase behaviour View Source
Thin implementation of the ExGcloudPubsubPuller.PullController behaviour.
To make use of this module, use
it, and implement the callbacks.
Examples
defmodule MySub do
use ExIhdlSubscriptionBase
@impl true
def moap_module(), do: "hm"
@impl true
def moap_key(), do: "rssi"
@impl true
def registry_topic(), do: "some-events-topic"
@impl true
def subscription_suffix, do: "some-service"
@impl true
def process_message(%PubsubMessage{data: data}) do
log_info("process_message: #{inspect(data)}")
cond do
do_something(data) ->
:ok
true ->
:error
end
end
end
Link to this section Summary
Callbacks
Should return the MOAP key for the desired data.
Should return the MOAP object under which to look for the MOAP key.
Gets called with each message received from the ingest pipe. Should return :ok
or :error
.
Should return the topic from which all events are sourced.
Should return the suffix to append to the generated subscription, recommended to be unique to this application (e.g. it's name).
Link to this section Callbacks
moap_key()
View Source
moap_key() :: String.t()
moap_key() :: String.t()
Should return the MOAP key for the desired data.
Examples
def moap_key(), do: "rssi"
moap_module()
View Source
moap_module() :: String.t()
moap_module() :: String.t()
Should return the MOAP object under which to look for the MOAP key.
Examples
def moap_module(), do: "hm"
process_message(arg1)
View Source
process_message(GoogleApi.PubSub.V1.Model.PubsubMessage.t()) :: :ok | :error
process_message(GoogleApi.PubSub.V1.Model.PubsubMessage.t()) :: :ok | :error
Gets called with each message received from the ingest pipe. Should return :ok
or :error
.
Examples
def process_message(msg), do: something(msg)
registry_topic()
View Source
registry_topic() :: String.t()
registry_topic() :: String.t()
Should return the topic from which all events are sourced.
Examples
def registry_topic(), do: "staging-eon-registry-events"
subscription_suffix()
View Source
subscription_suffix() :: String.t()
subscription_suffix() :: String.t()
Should return the suffix to append to the generated subscription, recommended to be unique to this application (e.g. it's name).
Examples
def subscription_suffix(), do: "my-app"