Conduit v0.12.10 Conduit.Broker.DSL View Source

Provides macros for setting up a message broker, subscribing to queues, publishing messages, and pipelines for processing messages.

Link to this section Summary

Functions

Defines the topology of a message broker

Defines configuration of an exchange

Defines a group of subscribers who share the same pipelines

Defines a group of outgoing message publications that share a set of pipelines

Defines a set of pipelines for the surrounding outgoing or incoming scope

Defines a message pipeline

Defines a plug as part of a pipeline

Defines a publisher

Defines configuration of a queue

Link to this section Functions

Link to this macro configure(list) View Source (macro)

Defines the topology of a message broker

You can use Conduit.Broker.DSL.queue/2 and Conduit.Broker.DSL.exchange/2 within a configure block.

Examples

configure do
  queue "my_app.created.account", durable: true
  queue "my_app.deleted.account", durable: true
end
Link to this macro exchange(name, opts \\ []) View Source (macro)

Defines configuration of an exchange

Examples

configure do
  exchange "my_app.topic", durable: true, type: :topic
  queue "my_app.deleted.account", durable: true, exchange: "my_app.topic"
end
Link to this macro incoming(namespace, list) View Source (macro)

Defines a group of subscribers who share the same pipelines

Examples

incoming MyApp do
  pipe_through [:in_tracking, :deserialize]

  subscribe :account_created, AccountCreatedSubscriber, from: "my_app.created.account"
end
Link to this macro outgoing(list) View Source (macro)

Defines a group of outgoing message publications that share a set of pipelines.

Examples

outgoing do
  pipe_through [:tracking, :serialize]

  publish :account_created, to: "my_app.created.account"
  publish :account_deleted, to: "my_app.deleted.account"
end
Link to this macro pipe_through(pipelines) View Source (macro)

Defines a set of pipelines for the surrounding outgoing or incoming scope

Examples

outgoing do
  pipe_through [:out_tracking, :serialize]

  publish :account_created, to: "my_app.created.account"
end

incoming MyApp do
  pipe_through [:in_tracking, :deserialize]

  subscribe :account_created, AccountCreatedSubscriber, from: "my_app.created.account"
end
Link to this macro pipeline(name, list) View Source (macro)

Defines a message pipeline

Examples

pipeline :serialize do
  plug Conduit.Plug.Format, content_type: "application/json"
  plug Conduit.Plug.Encode, content_encoding: "gzip"
end
Link to this macro plug(plug, opts \\ []) View Source (macro)

Defines a plug as part of a pipeline

Examples

pipeline :serialize do
  plug Conduit.Plug.Format, content_type: "application/json"
  plug Conduit.Plug.Encode, content_encoding: "gzip"
end
Link to this macro publish(name, opts \\ []) View Source (macro)

Defines a publisher

Examples

outgoing do
  publish :account_created, to: "my_app.created.account"
end
Link to this macro queue(name, opts \\ []) View Source (macro)

Defines configuration of a queue

Note: the name of the queue may only allow specific characters depending upon the message broker you use.

Examples

configure do
  queue "my_app.created.account", durable: true
  queue "my_app.deleted.account", durable: true
end
Link to this macro subscribe(name, subscriber, opts \\ []) View Source (macro)

Defines a subscriber

Examples

incoming MyApp do
  subscribe :account_created, AccountCreatedSubscriber, from: "my_app.created.account"
end