Solace-AMQP

Detailed documentation on the Solace-AMQP pubsub component

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.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: solace
  5. spec:
  6. type: pubsub.solace.amqp
  7. version: v1
  8. metadata:
  9. - name: url
  10. value: 'amqp://localhost:5672'
  11. - name: username
  12. value: 'default'
  13. - name: password
  14. value: 'default'
  15. - name: consumerID
  16. 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

FieldRequiredDetailsExample
urlYAddress of the AMQP broker. Can be secretKeyRef to 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]”
usernameYThe username to connect to the broker. Only required if anonymous is not specified or set to false .default
passwordYThe password to connect to the broker. Only required if anonymous is not specified or set to false.default
consumerIDNConsumer 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 consumerID is not provided, the Dapr runtime set it to the Dapr application ID (appID) value.“channel1”
anonymousNTo 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
caCertRequired for using TLSCertificate Authority (CA) certificate in PEM format for verifying server TLS certificates.“——-BEGIN CERTIFICATE——-\n<base64-encoded DER>\n——-END CERTIFICATE——-“
clientCertRequired for using TLSTLS client certificate in PEM format. Must be used with clientKey.“——-BEGIN CERTIFICATE——-\n<base64-encoded DER>\n——-END CERTIFICATE——-“
clientKeyRequired for using TLSTLS client key in PEM format. Must be used with clientCert. Can be secretKeyRef to 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:

  1. Ensure that the Solace broker is configured to support certificates.
  2. Provide the caCert, clientCert, and clientKey metadata in the component configuration.

For example:

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: solace
  5. spec:
  6. type: pubsub.solace.amqp
  7. version: v1
  8. metadata:
  9. - name: url
  10. value: "amqps://host.domain[:port]"
  11. - name: username
  12. value: 'default'
  13. - name: password
  14. value: 'default'
  15. - name: caCert
  16. value: ${{ myLoadedCACert }}
  17. - name: clientCert
  18. value: ${{ myLoadedClientCert }}
  19. - name: clientKey
  20. secretKeyRef:
  21. name: mySolaceClientKey
  22. key: mySolaceClientKey
  23. auth:
  24. secretStore: <SECRET_STORE_NAME>

While the caCert and clientCert values 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:

  1. 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.

Last modified June 19, 2023: Merge pull request #3565 from dapr/aacrawfi/skip-secrets-close (b1763bf)