Concurrency property with Solace Spring cloud stream api

matthesu
matthesu Unconfirmed, Member Posts: 13

I am using solace spring cloud stream apis to consume messages from a queue to a function. I would like to know how can I make it multi threaded using multiple message listeners(consumers) to the same queue so that I can process all the messages quickly. Concurrency property is not working, can you please give an example of a yml filewith proper use of concurrency property

Answers

  • swenhelge
    swenhelge Member, Employee Posts: 77 Solace Employee

    Hi,
    Did you set your queue to "non-exclusive" access mode? If that's set to "exclusive" only one of your instances will receive messages, the other will be on "stand-by". To achieve round robin to multiple consumer you will have to set "non-exclusive".
    Leah has blogged about this here ... https://solace.com/blog/solace-message-queue-access-types/

  • matthesu
    matthesu Unconfirmed, Member Posts: 13

    Thank you for your reply. The queue is already created as non-exclusive. Just wanted to see a sample yml file with concurrency property is set correctly. Right now, the consumer function is not fast enough. For eg. if we have 100 messages in the queue and if configure concurrency as 3, I am assuming it will automatically have 3 consumers so that all 100 messages can be processed in a faster way compared to the default set up with only 1 consumer.

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

    Hi @matthesu,
    Thanks for asking this. I would have expected the concurrency property to work as well. I'll look into it and let you know what I find.
    -Marc

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

    @matthesu when I tested this out I'm seeing the same thing as you. I've opened an issue here to track this: https://github.com/SolaceProducts/solace-spring-cloud/issues/7 and will try to remember to respond to this thread as well when there are any updates

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

    Hey @matthesu ,
    Just a heads up that support for concurrency will be in the next release and a PR is available here if you want to check it out before it's officially released.

    https://github.com/SolaceProducts/solace-spring-cloud/pull/8

    -Marc

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

    Hi @matthesu,
    Just a heads up that support for concurrency has been released as part of the SCSt Binder. More release info is here