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
Defines a subscriber
Link to this section Functions
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
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
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
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
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
Defines a message pipeline
Examples
pipeline :serialize do
plug Conduit.Plug.Format, content_type: "application/json"
plug Conduit.Plug.Encode, content_encoding: "gzip"
end
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
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