Queue and Error Queue provisioning when using Spring Cloud Stream binder for Solace PubSub+

Options
giri
giri Member, Administrator, Employee Posts: 105 admin
edited September 2022 in General Discussions #1

In an Enterprise context, queues and error queues are typically pre-provisioned, and applications simply connect to the queues at runtime to conduct their business.

Solace PubSub+ provides API to provision the queues at runtime. On the same line, Spring Cloud Stream binder for Solace PubSub+ provides facilities to dynamically provision queues via application configuration. If the queues are already present, the application reconnects - if not present, they are created dynamically.

Spring Cloud Stream supports error queues to capture messages not processed in the message handler in a separate queue for reprocessing or further analysis. Solace binder supports provisioning of both queues and error queues via configuration.

Here is an example:

      solace:
        bindings:
          uppercase-in-0:
            consumer:
              queueNameExpression: >-
                'CUSTOM-QUEUE'
              provisionDurableQueue: true
              errorQueueNameExpression: >-
                'ERROR-QUEUE'
              provisionErrorQueue: true
              autoBindErrorQueue: true

This will automatically create a queue and an error queue with the specified custom names on startup. Of course, ensure that the specified user's client profile is set with permission to create durable endpoints.

You can find more information about naming your queues in this blog - Custom Name for your Queues when using Spring Cloud Stream Binder for Solace PubSub+

Hope this helps!