SolaceProducts / solace-spring-cloud

An umbrella project containing all Solace projects for Spring Cloud
Apache License 2.0
22 stars 15 forks source link

Ability to configure prefetch size #92

Closed Akshay-Thakare closed 2 years ago

Akshay-Thakare commented 3 years ago

Hi,

It would be really helpful if we could configure prefetch size for consumers, similar to rabbitMQ binder to better control message flow. I understand this should be supported by solace as per this article https://solace.com/blog/configuring-pre-fetch-for-optimized-load-balancing/

Kindly add support for this. Thanks!

Mrc0113 commented 3 years ago

Hi @Akshay-Thakare,

It's a bit tricky, but you can actually configure both of these items today.

  1. The "MAX_DELIVERED_UNACKNOWLEDGED_MSGS_PER_FLOW" property is on a queue so you can actually set that (and other queue properties) today by using a queue template. These queue templates allow you to set a standard queue configuration that you'd like to use and when your app creates a queue dynamically. More info here: https://docs.solace.com/Configuring-and-Managing/Configuring-Endpoint-Templates.htm#Configur
  2. "FLOW_WINDOW_SIZE" is actually the same as "SUB_ACK_WINDOW_SIZE" which can be set in your spring config. I believe the proper property would be: solace.java.apiProperties.sub_ack_window_size

Note that MAX_DELIVERED_UNACKNOWLEDGED_MSGS_PER_FLOW should always be >= FLOW_WINDOW_SIZE or the FLOW_WINDOW_SIZE won't be taking any affect.

Hope that helps!

Akshay-Thakare commented 3 years ago

Hi @Mrc0113 ,

Thank you for your reply.

  1. If I understand correctly since MAX_DELIVERED_UNACKNOWLEDGED_MSGS_PER_FLOW should always be >= FLOW_WINDOW_SIZE so it is not necessary to set the same i.e. the defaults should work fine as long as FLOW_WINDOW_SIZE = 1 on client side. Is this correct?

  2. To set solace.java.apiProperties.sub_ack_window_size is the following code snippet correct?

    System.setProperty("spring.cloud.stream.binders.solace.environment.solace.java.apiProperties.sub_ack_window_size", "1");
Mrc0113 commented 2 years ago

Hi @Akshay-Thakare,

Sorry for the delayed response, did it work for you?

  1. Correct
  2. Yes that looks correct but you probably already know that by now :)