# Spring Cloud Stream Consumer Binding to a DMQ

**URL:** <https://community.solace.com/t/spring-cloud-stream-consumer-binding-to-a-dmq/486>\
**Category:** Solace Event Broker\
**Tags:** spring-cloud-stream\
**Created:** [November 15, 2020, 2:38pm UTC](https://community.solace.com/t/spring-cloud-stream-consumer-binding-to-a-dmq/486 "2020-11-15T14:38:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike13](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mike13](https://community.solace.com/u/Mike13)\
**Post date:** [November 15, 2020, 2:38pm UTC](https://community.solace.com/t/spring-cloud-stream-consumer-binding-to-a-dmq/486/1 "2020-11-15T14:38:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [November 16, 2020, 4:55pm UTC](https://community.solace.com/t/spring-cloud-stream-consumer-binding-to-a-dmq/486/2 "2020-11-16T16:55:32Z")

</div>

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](https://github.com/SolaceProducts/solace-spring-cloud/issues/28) 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](https://docs.solace.com/Configuring-and-Managing/Configuring-Endpoint-Templates.htm) 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:

```auto
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 🙂

---

<div class="post-metadata">

**Author:** ![Mike13](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mike13](https://community.solace.com/u/Mike13)\
**Post date:** [November 17, 2020, 7:01am UTC](https://community.solace.com/t/spring-cloud-stream-consumer-binding-to-a-dmq/486/3 "2020-11-17T07:01:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [November 17, 2020, 1:41pm UTC](https://community.solace.com/t/spring-cloud-stream-consumer-binding-to-a-dmq/486/4 "2020-11-17T13:41:25Z")

</div>

Awesome, you’re very welcome!
