FixAlchemy.PubSub behaviour (FIXAlchemy v0.3.0)
View SourceContract for publishing engine events to interested processes.
Session status changes, and the position, order and account updates the
subscriber bases produce, are published through the module configured here.
The default is FixAlchemy.PubSub.Phoenix, which forwards to Phoenix.PubSub
when it is available; with no server configured, publishing is a no-op and the
engine runs unchanged.
config :fix_alchemy,
pubsub: FixAlchemy.PubSub.Phoenix,
pubsub_server: MyApp.PubSubA host that publishes some other way supplies its own module:
defmodule MyApp.FixEvents do
@behaviour FixAlchemy.PubSub
@impl FixAlchemy.PubSub
def broadcast(_server, topic, message) do
MyApp.Telemetry.emit(topic, message)
:ok
end
end
Summary
Callbacks
Publish message on topic.
Functions
Publish message on topic through the configured implementation.
The configured implementation (default FixAlchemy.PubSub.Phoenix).
The engine-wide server name, from config :fix_alchemy, :pubsub_server.
Callbacks
Publish message on topic.
server is the per-session :pubsub_module option, or the value of
config :fix_alchemy, :pubsub_server for engine-wide events. Implementations
must return :ok and must tolerate a nil server.
Functions
Publish message on topic through the configured implementation.
@spec impl() :: module()
The configured implementation (default FixAlchemy.PubSub.Phoenix).
@spec server() :: term()
The engine-wide server name, from config :fix_alchemy, :pubsub_server.