View Source Commanded.PubSub (Commanded v1.4.8)

Use the pubsub configured for a Commanded application.

Summary

Functions

Get the configured pub/sub adapter.

Broadcasts message on given topic.

Subscribes the caller to the PubSub adapter's topic.

Types

application()

@type application() :: Commanded.Application.t()

config()

@type config() :: Keyword.t() | atom()

Functions

adapter(application, config)

@spec adapter(application(), config()) :: {module(), config()}

Get the configured pub/sub adapter.

Defaults to a local pub/sub, restricted to running on a single node.

broadcast(application, topic, message)

Broadcasts message on given topic.

  • topic - The topic to broadcast to, ie: "users:123"
  • message - The payload of the broadcast

subscribe(application, topic)

Subscribes the caller to the PubSub adapter's topic.