# In Spring cloud , i would like to read data from pre-define queue.

**URL:** <https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827>\
**Category:** Connectors & Integrations\
**Tags:** spring-cloud-stream, queue\
**Created:** [July 5, 2021, 4:25pm UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827 "2021-07-05T16:25:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![manzarul](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/manzarul/32/139_2.png) [@manzarul](https://community.solace.com/u/manzarul)\
**Post date:** [July 5, 2021, 4:25pm UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/1 "2021-07-05T16:25:33Z")

</div>

Currently spring cloud app will create the queue “scst/an/some randome-id/plain/myConsumer-in-0” at server startup (some thing similar), Since i already have a queue and queue has some persistence message so **how to command spring cloud to use existing queue for subscriptions**.

---

<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:** [July 6, 2021, 8:27pm UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/2 "2021-07-06T20:27:37Z")

</div>

Hi @manzarul,

If I understand you right, you’re wanting to have your Spring Cloud Stream app consume from a pre-provisioned queue that already has the proper topic subscriptions on it. AND that pre-provisioned queue does not follow the naming convention that the Cloud Stream binder expects. Correct?

By default the Solace binder uses this generated [Queue Name Syntax](https://github.com/SolaceProducts/solace-spring-cloud/tree/master/solace-spring-cloud-starters/solace-spring-cloud-stream-starter#generated-queue-name-syntax). You can adjust each part of that syntax using the available Solace binder consumer properties. To do what you want your config would look something like below. With that config your app would listen on the `myQueue` queue. It will also not try to provision the queue or topic subscriptions on the queue. Note we plan on making it easier to use custom queue names easier in a future release 🙂

```auto
spring:
  cloud:
    function:
      definition: myConsumer
    stream:
      bindings:
        myConsumer-in-0:
          destination: myQueue
          group: nonexclusive
      solace:
        bindings:
          myConsumer-in-0:
            consumer:
              provisionSubscriptionsToDurableQueue: false
              provisionDurableQueue: false
              queueNamePrefix: ""
              useFamiliarityInQueueName: false
              useDestinationEncodingInQueueName: false
              useGroupNameInQueueName: false

```

---

<div class="post-metadata">

**Author:** ![manzarul](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/manzarul/32/139_2.png) [@manzarul](https://community.solace.com/u/manzarul)\
**Post date:** [July 7, 2021, 11:25am UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/3 "2021-07-07T11:25:08Z")

</div>

Thanks your suggestion is working.

---

<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:** [July 7, 2021, 1:36pm UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/4 "2021-07-07T13:36:01Z")

</div>

Excellent, glad I could help!

---

<div class="post-metadata">

**Author:** ![manzarul](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/manzarul/32/139_2.png) [@manzarul](https://community.solace.com/u/manzarul)\
**Post date:** [July 19, 2021, 12:50pm UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/5 "2021-07-19T12:50:27Z")

</div>

This can be closed now.

---

<div class="post-metadata">

**Author:** ![Monica\_Gavali](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Monica\_Gavali](https://community.solace.com/u/Monica_Gavali)\
**Post date:** [September 30, 2021, 6:38am UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/6 "2021-09-30T06:38:21Z")

</div>

Hi Mark ,

I am trying to connect to predefined company provided queue(BRV\_INTRADAY\_TEST). Did same changes like above but still consumer is not able to pull messages from queue. there is no group for BRV\_INTRADAY\_TEST.

Sharing yaml file below:

```auto
spring:
  cloud:
    function:
      definition: receiveAll
    stream:
      bindings:
        receiveAll-in-0:
          destination: BRV_INTRADAY_TEST
      solace:
        bindings:
          receiveAll-in-0:
            consumer:
              provisionSubscriptionsToDurableQueue: false
              provisionDurableQueue: false
              queueNamePrefix: ""
              useFamiliarityInQueueName: false
              useDestinationEncodingInQueueName: false
              useGroupNameInQueueName: false
      binders:
        local-solace:
          type: solace
          environment:
            solace:
              java:
                host: host01
                msgVpn: msgVpn01
                clientUsername: clientUsername01
                clientPassword: clientPassword01

```

---

<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:** [October 1, 2021, 3:00pm UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/7 "2021-10-01T15:00:18Z")

</div>

Hi @Monica_Gavali ,

Did you get an error? or you’re just not seeing it bind to the expect queue name? I think the potential point of confusion here is that the solace binder uses durable queues to implement the consumer group pattern and temporary queues to implement the publish-subscribe pattern as defined by Spring Cloud Stream. So if you’re not using a group it will not be trying to bind to a existing durable queue because it instead if creating a unique temporary queue for this application. I think it would be worth taking a look at the [Communication Models and How to Choose](https://codelabs.solace.dev/codelabs/spring-cloud-stream-beyond/index.html?index=..%2F..index#2) section of the [Spring Cloud Stream - Beyond the Basics](https://codelabs.solace.dev/codelabs/spring-cloud-stream-beyond/) codelab that I think can help clarify this.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Monica\_Gavali](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Monica\_Gavali](https://community.solace.com/u/Monica_Gavali)\
**Post date:** [October 4, 2021, 8:21am UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/8 "2021-10-04T08:21:55Z")

</div>

ok… Thanks !!! 🙂

---

<div class="post-metadata">

**Author:** ![chatumoh](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@chatumoh](https://community.solace.com/u/chatumoh)\
**Post date:** [April 18, 2023, 4:15am UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/9 "2023-04-18T04:15:33Z")

</div>

I am using @StreamListner, created &nbsp;input binding of type SubscribableChannel & trying to connect to a pre-provisioned queue and used similar configurations as suggested in previous comment but i am not able to bind consumer with queue .  
Getting error - “EL1008E: Property or field ‘isAnonymous’ cannot be found on object of type ‘com.solace.spring.cloud.stream.binder.provisioning.ExpressionContextRoot’ - maybe not public or not valid?” .  
Did try providing queue-name-expression as well as string literal as suggested in blog post [https://solace.com/blog/custom-name-for-queues-spring-cloud-stream-binder/](https://solace.com/blog/custom-name-for-queues-spring-cloud-stream-binder/) nothing seems to work i keep in getting above error or SpelExpression error i.e. Caused by: org.springframework.expression.spel.SpelParseException: EL1041E: After parsing a valid expression, there is still more data in the expression: ‘rparen())’ .

---

<div class="post-metadata">

**Author:** ![Aaron](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/aaron/32/843_2.png) [@Aaron](https://community.solace.com/u/Aaron)\
**Post date:** [April 19, 2023, 7:34am UTC](https://community.solace.com/t/in-spring-cloud-i-would-like-to-read-data-from-pre-define-queue/827/10 "2023-04-19T07:34:40Z")

</div>

@chatumoh can you start a new discussion please?  
EDIT: nevermind, I saw that you did.
