Spring Cloud Stream Consumer Binding to a DMQ
Hi there
Is there a way to bind a Spring Cloud Stream consumer to a DMQ?
I tried things like that:
failedMessage-in-0: destination: DEAD_MSG_QUEUE contentType: "application/text"
But a consumer always binds to a queue which has a subsciption to the topic (in destination), right?
So this doesn't work.
Is there a solution for this?
Thanks and best regards
Mike
Comments
-
Hi @Mike13,
Currently the Solace Spring Cloud Stream binder enforces an "opinionated view" where the queue name is dynamically created (or expected to be) as {prefix}{destination}.{group}. We have an enhancement open to allow for this opinion to be overridden, but in the meantime I think I have a solution for you.I believe this should work for you:
- Set a custom DMQ name that ends with
.DMQ
. For example's sake, let's useFOO.DMQ
(Note you can set the DMQ on each queue using SEMP/cli/PS+ Mgr or set up an endpoint template that automatically adds it based on queue naming) - Split the DMQ on the
.
and have your Spring Cloud Stream Binding use the first part (FOO
in our example) as thedestination
and set the group name to be the second part (DMQ
in our example) - Disable automatic provisioning of the queue (assuming you already created the queue you want to consume from) & subscriptions
So your binding config would end up looking like this:
spring.cloud.function.definition=failedMessage spring.cloud.stream.bindings.failedMessage-in-0.destination=FOO spring.cloud.stream.bindings.failedMessage-in-0.group=DMQ spring.cloud.stream.solace.bindings.failedMessage-in-0.consumer.provisionDurableQueue=false spring.cloud.stream.solace.bindings.failedMessage-in-0.consumer.provisionSubscriptionsToDurableQueue=false
Let me know if it works
1 - Set a custom DMQ name that ends with