Apache RocketMQ binding spec

Detailed documentation on the Apache RocketMQ binding component

Component format

To set up an Apache RocketMQ binding, create a component of type bindings.rocketmq.
See this guide on how to create and apply a binding configuration.

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: <NAME>
spec:
  type: bindings.rocketmq
  version: v1
  metadata:
    - name: accessProto
      value: "tcp"
    - name: nameServer
      value: "localhost:9876"
    - name: endpoint
      value: "http://localhost:8080"
    - name: topics
      value: "topic1,topic2"
    - name: consumerGroup
      value: "my-consumer-group"
    # Optional
    - name: consumerBatchSize
      value: "10"
    - name: consumerThreadNums
      value: "4"
    - name: retries
      value: "3"
    - name: instanceId
      value: "my-instance"

Spec metadata fields

FieldRequiredBinding supportDetailsExample
topicsYInput/OutputComma-separated list of topics for publishing or subscribing."topic1,topic2"
nameServerNInput/OutputAddress of the RocketMQ name server."localhost:9876"
endpointNInput/OutputRocketMQ endpoint (for http protocol)."http://localhost:8080"
accessProtoNInput/OutputSDK protocol for connecting to RocketMQ."tcp", "tcp-cgo", "http"
consumerGroupNInput/OutputConsumer group name for RocketMQ subscribers."my-consumer-group"
consumerBatchSizeNInputBatch size for consuming messages."10"
consumerThreadNumsNInputNumber of consumer threads (for tcp-cgo protocol)."4"
instanceIdNInput/OutputRocketMQ namespace instance ID."my-instance"
nameServerDomainNInput/OutputDomain name for the RocketMQ name server."rocketmq.example.com"
retriesNInput/OutputNumber of retry attempts to connect to the RocketMQ broker."3"
accessKeyNInput/OutputAccess key for authentication. Required if access control is enabled."access-key"
secretKeyNInput/OutputSecret key for authentication. Required if access control is enabled."secret-key"

Note: accessKey and secretKey can be stored in a Dapr secret store instead of the YAML file for improved security.

Authentication Using Access Keys

To use access key authentication, include the following metadata fields in the configuration:

- name: accessKey
  secretKeyRef:
    name: rocketmq-secrets
    key: accessKey
- name: secretKey
  secretKeyRef:
    name: rocketmq-secrets
    key: secretKey

This allows secure retrieval of credentials from a secret store.

Binding support

This component supports both input and output binding interfaces.

This component supports output binding with the following operations:

  • create: publishes a new message
  • read: consumes messages from RocketMQ topics

Set topic per-request

You can override the topic in component metadata on a per-request basis:

{
  "operation": "create",
  "metadata": {
    "topics": "dynamicTopic"
  },
  "data": "This is a test message for RocketMQ!"
}

Retry behavior

Use the retries metadata field to specify how many times Dapr should attempt to connect to RocketMQ before failing:

- name: retries
  value: "5"
Last modified September 1, 2025: [1.16] Adds RocketMQ binding (#4835) (83b5e092)