Skip to content

amqp://

AMQP 1.0 messaging via github.com/Azure/go-amqp. Sender/Receiver links, dynamic reply-to, settled vs unsettled delivery, SASL PLAIN/ANONYMOUS/EXTERNAL, TLS + mTLS. JMS-bean parameters (connection factories, transactions) are intentionally not part of the surface.

For AMQP 0-9-1 (RabbitMQ wire protocol), use rabbitmq:// — same dial syntax, different on-wire protocol.

URI shape

amqp://<address>?[options]

<address> is the queue / topic name (or any AMQP 1.0 source/target address). Use destinationType=queue|topic|temp-queue|temp-topic to hint the broker convention.

Parameters

Connection

Param Type Default Description
address path — AMQP 1.0 destination name (path token).
url string amqp://guest:guest@localhost:5672/ Broker URL (amqp:// or amqps://). Inline auth supported.
username string — SASL PLAIN username. Overrides inline-URL auth when set.
password string — SASL PLAIN password.
sasl enum inferred PLAIN / ANONYMOUS / EXTERNAL. Default infers PLAIN from credentials, else ANONYMOUS.
clientId string — AMQP container-id (JMS clientId semantics).
idleTimeout duration 30s AMQP idle-timeout heartbeat.
connectionTimeout duration 30s Dial timeout.
maxFrameSize integer 65536 Max AMQP frame size in bytes.
connectionName string — connection.Properties["connection_name"] for broker-management visibility.
testConnectionOnStartup boolean false Eager-validate broker connection at endpoint creation.
reconnect boolean true Enable automatic reconnect on connection loss.
maxReconnectAttempts integer -1 Max reconnect attempts. -1 = unlimited.
recoveryInterval duration 2s Delay between reconnect attempts.

TLS

Param Type Default Description
secure boolean false Force TLS handshake (equivalent to amqps://).
tlsCAFile string — PEM CA bundle.
tlsCertFile string — PEM client cert (mTLS / SASL EXTERNAL).
tlsKeyFile string — PEM client private key.
tlsInsecureSkipVerify boolean false Skip server cert verification. Insecure.
tlsMinVersion / tlsMaxVersion enum — Pin TLS version.
tlsCipherSuites string — Comma-separated Go cipher-suite names.

Address

Param Type Default Description
destinationType enum — queue / topic / temp-queue / temp-topic. Affects broker-specific prefix; temp-* triggers dynamic server-named address.

Common

Param Type Default Description
replyTo string — Default reply-to address (overrides inbound reply-to header).
disableReplyTo boolean false Consumer: ignore inbound reply-to (suppress auto-reply with route output).

Consumer

Param Type Default Description
acknowledgementModeName enum AUTO_ACKNOWLEDGE AUTO_ACKNOWLEDGE / DUPS_OK_ACKNOWLEDGE / CLIENT_ACKNOWLEDGE.
concurrentConsumers integer 1 Minimum concurrent receiver goroutines (floor).
maxConcurrentConsumers integer 1 Actual concurrent receiver goroutines per endpoint.
prefetchCount integer 50 AMQP 1.0 link-credit window.
receiveTimeout duration 0 Timeout per Receive() call. 0 = block indefinitely.
selector string — Broker-side filter expression (JMS-selector syntax). Pass-through via AMQP 1.0 selector filter.

In CLIENT_ACKNOWLEDGE mode the processor controls the disposition via the amqp.SETTLE header on the outbound exchange (accept / release / reject). A missing/unknown value defaults to release (forces redelivery) — matching JMS CLIENT_ACKNOWLEDGE semantics.

Producer

Param Type Default Description
allowNullBody boolean true Allow empty-body messages.
deliveryMode enum PERSISTENT PERSISTENT / NON_PERSISTENT.
priority integer 4 Message priority 0–9.
timeToLive duration — TTL header on outbound messages.
requestTimeout duration 20s InOut reply timeout AND send timeout.

Headers

Param Type Description
headerIncludePattern string regex Pass only matching header names. Empty = all.
headerExcludePattern string regex Drop matching header names.

Body shape

Producer

  • In body — sent as the AMQP message data (Data[0] from BodyAsBytes()).
  • In headers — pass-filtered → application-properties.
  • InOut exchanges open a per-link reply receiver (dynamic source); reply body replaces the In body.

Consumer

For each received message:

  • In body — message data bytes.
  • In headers:
Header Description
amqp.CONTENT_TYPE Message content-type.
amqp.MESSAGE_ID Message message-id.
amqp.CORRELATION_ID Message correlation-id.
amqp.REPLY_TO Message reply-to.
amqp.TO Message to.
amqp.SUBJECT Message subject.
amqp.PRIORITY Header priority (when > 0).
amqp.REDELIVERED "true" when delivery count > 0.

Plus pass-filtered application-properties as In headers.

Headers

The constants are exported in code as:

Constant Value Direction
amqp.HeaderContentType amqp.CONTENT_TYPE both
amqp.HeaderMessageID amqp.MESSAGE_ID both
amqp.HeaderCorrelationID amqp.CORRELATION_ID both
amqp.HeaderReplyTo amqp.REPLY_TO both
amqp.HeaderTo amqp.TO both
amqp.HeaderSubject amqp.SUBJECT both
amqp.HeaderPriority amqp.PRIORITY both
amqp.HeaderTTL amqp.TTL producer
amqp.HeaderRedelivered amqp.REDELIVERED inbound
amqp.HeaderSettle amqp.SETTLE outbound (CLIENT_ACKNOWLEDGE only)

HeaderSettle values: accept / release / reject.

Examples

Consume from an AMQP queue:

- id: orders
  from: amqp://orders?url=amqp://guest:guest@broker:5672/&prefetchCount=100&maxConcurrentConsumers=4
  steps:
    - to: direct://process-order

Send with persistent delivery + priority:

- setHeader:
    name: amqp.PRIORITY
    constant: "9"
- to: amqp://critical?url=amqp://broker:5672/&deliveryMode=PERSISTENT

InOut request/reply (dynamic reply-to):

- to: amqp://inventory.lookup?url=amqp://broker:5672/&requestTimeout=2s

TLS + mTLS via SASL EXTERNAL:

- to: amqp://secure?url=amqps://broker.example.com:5671/&sasl=EXTERNAL&tlsCertFile=/etc/ssl/client.crt&tlsKeyFile=/etc/ssl/client.key&tlsCAFile=/etc/ssl/ca.pem

CLIENT_ACKNOWLEDGE with selective dispositions:

- from: amqp://work?url=amqp://broker:5672/&acknowledgementModeName=CLIENT_ACKNOWLEDGE
  steps:
    - choice:
        when:
          - starlang: 'body == "poison"'
            steps:
              - setHeader:
                  name: amqp.SETTLE
                  constant: reject       # dead-letter
        otherwise:
          steps:
            - to: direct://process
            - setHeader:
                name: amqp.SETTLE
                constant: accept

Behavior notes

  • AMQP 1.0 only. For RabbitMQ-style AMQP 0-9-1, use rabbitmq://.
  • Connection pool. Endpoints with identical connection config share a connection via connection_pool.go.
  • maxConcurrentConsumers. Auto-promoted to at least concurrentConsumers. Each goroutine maintains its own Receiver link.
  • CLIENT_ACKNOWLEDGE default disposition is release. Matches JMS — forgetting to set amqp.SETTLE causes the broker to redeliver.
  • Header filter is symmetric. The same regex governs both directions; the include is applied first, then the exclude.
  • Reconnect. A Reconnector resets the entire link on transport failure. recoveryInterval sets the delay.

Source

  • pkg/component/amqp/amqp.go — Component, Endpoint.
  • pkg/component/amqp/{producer,consumer}.go — link I/O, settle handling.
  • pkg/component/amqp/{config,security,connection_pool,headers,address}.go — config parsing, TLS+SASL, pooling, header filter, address types.

See also