Sends messages to an AMQP exchange.
to_amqp url:secret, [message=str|blob, channel=int, exchange=str, routing_key=str, options=record, mandatory=bool, immediate=bool]Description
Section titled “Description”The to_amqp operator is an AMQP 0-9-1 client that
sends messages to an exchange. It sends one AMQP message per input event.
By default, to_amqp serializes each input event as NDJSON. Use the message
option to send a specific string or blob expression instead. If the expression
evaluates to null or another type, the operator skips that event and emits a
warning.
url: secret
Section titled “url: secret”The URL of the AMQP server. The URL must have the following format:
amqp://[USERNAME[:PASSWORD]@]HOSTNAME[:PORT]/[VHOST]The URL is required. Values in the URL override corresponding entries from
options.
message = str | blob (optional)
Section titled “message = str | blob (optional)”The expression that produces the AMQP message body.
Defaults to this.print_ndjson().
channel = int (optional)
Section titled “channel = int (optional)”The channel number to use.
The value must fit into an unsigned 16-bit integer.
Defaults to 1.
exchange = str (optional)
Section titled “exchange = str (optional)”The exchange to publish to.
Defaults to "amq.direct".
routing_key = str (optional)
Section titled “routing_key = str (optional)”The routing key to publish messages with.
Defaults to the empty string.
options = record (optional)
Section titled “options = record (optional)”An option record for the AMQP connection. Values must be numbers, booleans, strings, or secrets.
Available options are:
hostname: 127.0.0.1port: 5672ssl: falsevhost: /max_channels: 2047frame_size: 131072heartbeat: 0sasl_method: plainusername: guestpassword: guestmandatory = bool (optional)
Section titled “mandatory = bool (optional)”If true, the broker returns an unroutable message instead of silently dropping
it.
Defaults to false.
immediate = bool (optional)
Section titled “immediate = bool (optional)”If true, the broker returns an undeliverable message when no consumer can
receive it immediately.
Defaults to false.
Examples
Section titled “Examples”Send events to an AMQP exchange
Section titled “Send events to an AMQP exchange”pluginsto_amqp "amqp://admin:pass@0.0.0.1:5672/vhost"Send a specific field as the message body
Section titled “Send a specific field as the message body”from {payload: "hello"}to_amqp "amqp://admin:pass@0.0.0.1:5672/vhost", message=payloadConfigure connection options
Section titled “Configure connection options”from {payload: "hello"}to_amqp "amqp://broker/vhost", message=payload, options={ username: "tenzir", password: secret("amqp-password"), heartbeat: 30,}