Skip to content

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]

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.

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.

The expression that produces the AMQP message body.

Defaults to this.print_ndjson().

The channel number to use.

The value must fit into an unsigned 16-bit integer.

Defaults to 1.

The exchange to publish to.

Defaults to "amq.direct".

The routing key to publish messages with.

Defaults to the empty string.

An option record for the AMQP connection. Values must be numbers, booleans, strings, or secrets.

Available options are:

hostname: 127.0.0.1
port: 5672
ssl: false
vhost: /
max_channels: 2047
frame_size: 131072
heartbeat: 0
sasl_method: plain
username: guest
password: guest

If true, the broker returns an unroutable message instead of silently dropping it.

Defaults to false.

If true, the broker returns an undeliverable message when no consumer can receive it immediately.

Defaults to false.

plugins
to_amqp "amqp://admin:pass@0.0.0.1:5672/vhost"
from {payload: "hello"}
to_amqp "amqp://admin:pass@0.0.0.1:5672/vhost", message=payload
from {payload: "hello"}
to_amqp "amqp://broker/vhost", message=payload, options={
username: "tenzir",
password: secret("amqp-password"),
heartbeat: 30,
}

Last updated: