Solace Community is getting a facelift!

On March 3rd we will be starting the process of migrating Solace Community to a new platform. As a result, Solace Community will go in to a temporary read-only state. You will still be able to come onto Solace Community and search through posts to find answers, but you won't be able to ask questions, post comments, or react in any way.

We hope to have the migration complete by Wednesday March 5th (or sooner), so please keep an eye out!

Spring Cloud Stream Consumer Binding to a DMQ

Mike13
Mike13 Member Posts: 29

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

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 973 admin

    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 use FOO.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 the destination 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 :)

  • Mike13
    Mike13 Member Posts: 29

    Hi @marc
    Nice one, this works for me :-).
    Thanks!

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 973 admin

    Awesome, you're very welcome!

This Month's Leaders

This Week's Leaders