View Source OffBroadwayAmqp10.Producer (off_broadway_amqp10 v0.1.0)
An AMQP 1.0 producer for Broadway.
features
Features
- Automatically acknowledges/rejects messages.
options
Options
:queue- Required. The name of the queue or topic:connection- Required. Connection options based on:amqp10_client_connection.connection_config/0:hostname- Required. The hostname:port- Required. The port number:sasl- Required. [mechanism: :plain, username: "foo", password: "bar"]. In Azure Service Bus username isSharedAccessKeyNameand password isSharedAccessKey:mechanism- Required.:username- Required.:password- Required.
:tls_opts:transfer_limit_margin- The max amount of credit that could be requested. The default value is100.
:session- Required. Session options The default value is[snd_settle_mode: :mixed, rcv_settle_mode: :second].:name- Required. When using topics in Azure Service Bus, it's calledSubscription Name. Otherwise just an arbitrary name.:snd_settle_mode-unsettled: The sender will send all deliveries initially unsettled to the receiver.settled: The sender will send all deliveries settled to the receiver.mixed: The sender may send a mixture of settled and unsettled deliveries to the receiver. The default value is:mixed.:rcv_settle_mode-first: The receiver will spontaneously settle all incoming transfers.second: The receiver will only settle after sending the disposition to the sender and receiving a disposition indicating settlement of the delivery from the sender. The default value is:second.
example
Example
Broadway.start_link(MyBroadway,
name: MyBroadway,
producer: [
module:
{OffBroadwayAmqp10.Producer,
queue: "my_queue",
connection: [
host: "my-service.servicebus.windows.net"
sasl: [mechanism: :plain, username: "foo", password: "bar"],
tls_opts: [],
transfer_limit_margin: 100
],
session: [
name: to_string(node())
]
concurrency: 1
],
processors: [
default: [
concurrency: 2,
]
]
)
message
Message
The messages which you receive at the Broadway's processors is like:
message = %Broadway.Message{
data: "raw message body",
metadata: %{
headers: %{delivery_count: 0, durable: false, ... }
properties: %{creation_time: 1_656_945_422_583, ...},
application_properties: %{"foo" => "bar", ...},
annotations: %{"x-opt-sequence-number" => 6068, .. }
}
}
acking
Acking
Successful messages are acked and failed messages are rejected