The documentation you are viewing is for Dapr v1.13 which is an older version of Dapr. For up-to-date documentation, see the latest version.
Solace-AMQP
Component format
To set up Solace-AMQP pub/sub, create a component of type pubsub.solace.amqp. See the pub/sub broker component file to learn how ConsumerID is automatically generated. Read the How-to: Publish and Subscribe guide on how to create and apply a pub/sub configuration.
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: solace
spec:
  type: pubsub.solace.amqp
  version: v1
  metadata:
    - name: url
      value: 'amqp://localhost:5672'
    - name: username
      value: 'default'
    - name: password
      value: 'default'
    - name: consumerID
      value: 'channel1'
Warning
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.Spec metadata fields
| Field | Required | Details | Example | 
|---|---|---|---|
| url | Y | Address of the AMQP broker. Can be secretKeyRefto use a secret reference.Use the amqp://URI scheme for non-TLS communication.Use the amqps://URI scheme for TLS communication. | "amqp://host.domain[:port]" | 
| username | Y | The username to connect to the broker. Only required if anonymous is not specified or set to false. | default | 
| password | Y | The password to connect to the broker. Only required if anonymous is not specified or set to false. | default | 
| consumerID | N | Consumer ID (consumer tag) organizes one or more consumers into a group. Consumers with the same consumer ID work as one virtual consumer; for example, a message is processed only once by one of the consumers in the group. If the consumerIDis not provided, the Dapr runtime set it to the Dapr application ID (appID) value. | "channel1" | 
| anonymous | N | To connect to the broker without credential validation. Only works if enabled on the broker. A username and password would not be required if this is set to true. | true | 
| caCert | Required for using TLS | Certificate Authority (CA) certificate in PEM format for verifying server TLS certificates. | "-----BEGIN CERTIFICATE-----\n<base64-encoded DER>\n-----END CERTIFICATE-----" | 
| clientCert | Required for using TLS | TLS client certificate in PEM format. Must be used with clientKey. | "-----BEGIN CERTIFICATE-----\n<base64-encoded DER>\n-----END CERTIFICATE-----" | 
| clientKey | Required for using TLS | TLS client key in PEM format. Must be used with clientCert. Can besecretKeyRefto use a secret reference. | "-----BEGIN RSA PRIVATE KEY-----\n<base64-encoded PKCS8>\n-----END RSA PRIVATE KEY-----" | 
Communication using TLS
To configure communication using TLS:
- Ensure that the Solace broker is configured to support certificates.
- Provide the caCert,clientCert, andclientKeymetadata in the component configuration.
例如:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: solace
spec:
  type: pubsub.solace.amqp
  version: v1
  metadata:
  - name: url
    value: "amqps://host.domain[:port]"
  - name: username
    value: 'default'
  - name: password
    value: 'default'
  - name: caCert
    value: ${{ myLoadedCACert }}
  - name: clientCert
    value: ${{ myLoadedClientCert }}
  - name: clientKey
    secretKeyRef:
      name: mySolaceClientKey
      key: mySolaceClientKey
auth:
  secretStore: <SECRET_STORE_NAME>
While the
caCertandclientCertvalues may not be secrets, they can be referenced from a Dapr secret store as well for convenience.
Publishing/subscribing to topics and queues
By default, messages are published and subscribed over topics. If you would like your destination to be a queue, prefix the topic with queue: and the Solace AMQP component will connect to a queue.
Create a Solace broker
You can run a Solace broker locally using Docker:
docker run -d -p 8080:8080 -p 55554:55555 -p 8008:8008 -p 1883:1883 -p 8000:8000 -p 5672:5672 -p 9000:9000 -p 2222:2222 --shm-size=2g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --name=solace solace/solace-pubsub-standard
You can then interact with the server using the client port: mqtt://localhost:5672
You can also sign up for a free SaaS broker on Solace Cloud.
Related links
- Basic schema for a Dapr component
- Read this guide for instructions on configuring pub/sub components
- Pub/sub building block
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.