Skip to content

stomp://

STOMP 1.2 messaging via github.com/go-stomp/stomp/v3. Broker-agnostic — speaks to ActiveMQ Classic, ActiveMQ Artemis, RabbitMQ (with STOMP plugin), HornetQ, or any STOMP-compliant broker. Covers the JMS-portable surface (selectors, durable subscriptions, ack modes, request/reply) without needing a JVM or Spring beans.

For AMQP 1.0 (Artemis-native binary protocol), use amqp://. For AMQP 0-9-1 (RabbitMQ-native), use rabbitmq://. For MQTT (IoT pub/sub), use mqtt://.

URI shape

stomp://<destination>?[options]
activemq://<destination>?[options]      # alias, identical surface

<destination> is the broker-side destination name, passed through verbatim. Use whatever prefix convention your broker recognises:

  • Artemis: /queue/<name> or /topic/<name>
  • ActiveMQ Classic: /queue/<name> or /topic/<name>
  • RabbitMQ + STOMP plugin: /exchange/<exchange>/<routing-key> or /queue/<name>

Parameters

Connection

Param Type Default Description
<destination> path — STOMP destination (path token).
brokerURL string tcp://localhost:61613 Broker URL (tcp:// or ssl://).
brokerHost string — Convenience host (used when brokerURL unset).
brokerPort string 61613 Convenience port.
host string — STOMP CONNECT host header (virtual host).
login string — Username.
passcode string — Password.
version enum 1.2 STOMP protocol version: 1.0/1.1/1.2.
clientId string — Durable-subscription identity. Sent as client-id.
heartBeat string 10000,10000 STOMP 1.1+ heart-beat — <send-ms>,<recv-ms>.
connectTimeout duration 30s TCP/TLS dial timeout.
readTimeout duration 0 STOMP frame read deadline. 0 disables.
writeTimeout duration 30s STOMP frame write deadline.
maxReconnectAttempts integer -1 Max reconnect attempts. -1 = unlimited; 0 disables reconnect.
recoveryInterval duration 5s Initial backoff between reconnect attempts.
testConnectionOnStartup boolean false Eager-validate broker at endpoint creation.

TLS

Param Type Default Description
tlsCAFile string — PEM CA bundle for broker cert verification.
tlsCertFile string — PEM client cert (mTLS).
tlsKeyFile string — PEM client key (mTLS).
tlsInsecureSkipVerify boolean false Skip server cert verification (insecure).
tlsMinVersion enum — Pin min TLS version (TLSv1.0/1.1/1.2/1.3).
tlsMaxVersion enum — Pin max TLS version.
tlsCipherSuites string — Comma-separated cipher-suite whitelist (Go names).

Common

Param Type Default Description
replyTo string — Producer: default reply-to destination.
disableReplyTo boolean false Consumer: ignore inbound reply-to, suppress auto-reply.
requestTimeout duration 20s Producer InOut reply timeout / fire-and-forget send timeout.
receiveTimeout duration 0 Consumer Receive() timeout (0 = block).

Consumer

Param Type Default Description
ack enum auto auto / client / client-individual.
concurrentConsumers integer 1 Subscriber goroutines per endpoint.
selector string — Broker-side filter (JMS-selector syntax).
durable boolean false Open a durable subscription. Requires subscriptionName.
subscriptionName string — Durable-subscription id.
prefetch integer 50 Prefetch hint (activemq.prefetchSize + prefetch-count headers).

Producer

Param Type Default Description
persistent boolean true STOMP SEND persistent header.
priority integer 4 STOMP SEND priority (0–9).
timeToLive duration — TTL → expires header (absolute epoch-ms).
allowNullBody boolean true Allow empty-body messages.
useMessageIDAsCorrelationID boolean false On InOut, set correlation-id from outbound message-id when no explicit value.

Headers

Param Type Default Description
header.<NAME> string — Repeatable. Custom STOMP header on CONNECT and every SEND.
headerIncludePattern string — Regex — only matching headers pass through.
headerExcludePattern string — Regex — matching headers are dropped (applied after include).

Examples

Producer + consumer roundtrip

workflows:
  - id: produce
    trigger:
      uri: timer://tick?period=2s
    steps:
      - to: stomp:///queue/orders?priority=8

  - id: consume
    trigger:
      uri: stomp:///queue/orders?ack=client
    steps:
      - to: log://stdout?showBody=true

Durable topic subscription

workflows:
  - id: events
    trigger:
      uri: stomp:///topic/announcements
      params:
        durable: "true"
        subscriptionName: "my-app"
        clientId: "my-app-1"
        prefetch: "10"
    steps:
      - to: direct://announcement-handler

activemq:// alias with selector

workflows:
  - id: high-priority
    trigger:
      uri: activemq:///queue/orders?selector=JMSPriority%20%3E%205
    steps:
      - to: log://stdout

TLS + custom headers (multi-tenant)

workflows:
  - id: tenant-publish
    trigger:
      uri: timer://tick?period=1m
    steps:
      - to: stomp:///queue/audit
        params:
          brokerURL: "ssl://broker.example.com:61612"
          tlsCAFile: "/etc/helix/broker-ca.pem"
          login: "audit-svc"
          passcode: "${AUDIT_PASSWORD}"
          header.X-Tenant: "acme"
          header.X-Source: "ingest-v2"

See also

  • Docker-live test against Artemis: go test -tags=docker_live ./pkg/component/stomp/...
  • Related components: amqp:// (AMQP 1.0), rabbitmq:// (AMQP 0-9-1), mqtt:// (MQTT 3.1.1).