Try PubSub+

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

manzarulmanzarul Member Posts: 10

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.

Best Answer

  • marcmarc Member, Administrator, Moderator, Employee Posts: 469 admin
    #2 Accepted Answer

    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. 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 :)

    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
    

Answers

  • marcmarc Member, Administrator, Moderator, Employee Posts: 469 admin
    #3 Accepted Answer

    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. 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 :)

    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
    
  • manzarulmanzarul Member Posts: 10

    Thanks your suggestion is working.

  • marcmarc Member, Administrator, Moderator, Employee Posts: 469 admin

    Excellent, glad I could help!

  • manzarulmanzarul Member Posts: 10

    This can be closed now.

Sign In or Register to comment.