0

I have a Spring Boot based Java application which reads messages from a Solace queue(let's say A) using javax.jms. Then my application applies a 10 seconds delay to each messages individually(using DelayedQueue). Once that 10 seconds have been passed, I push the message to another Solace Queue(let's say B). It all works fine, even I can have proper 10 seconds delay for each message if we have less initial messages in queue A.

But the challenge for me is that if I have huge number of messages in queue A(generally happens in my use case), and when I start the application, it pulls messages very fast(10-15K messages per second). This makes my application go out of memory(GC overhead limit exceeded).

Question: My question is how to slow down the consumption speed in my application. Do we have a way by which I can have around 2-3K messages per second. Do I need to do some configuration changes in my code. Please advise.

Below are the settings I tried, it doesn't help. Even after this my application pulls 12-15K messages per second:

environment.put(SupportedProperty.SOLACE_JMS_CONSUMER_DEFAULT_FLOW_CONGESTION_LIMIT, 2000);
environment.put(SupportedProperty.SOLACE_JMS_CONSUMER_DISPATCHER_QUEUE_SIZE, 2000);

Even I tried to increase heap memory(initial:2GB and max: 4GB) but it doesn't help.

Kindly help. Thanks!

P.S. I can't use TTL here, it has to be done using our application only.

Rohit
  • 188
  • 2
  • 18

1 Answers1

1

You can limit the number of messages sent to your application at a time by adjusting both the Guaranteed Message Window Size in your API properties, and the max-delivered-unacked-messages-per-flow parameter for your queue on your Solace event broker. This will control how many messages are delivered to the API before receiving either a transport acknowledgement, or application acknowledgement.

In JMS, you can set the Guaranteed Message Window Size in the Connection Factory on the broker.

Alexandra Masse
  • 1,277
  • 1
  • 7
  • 11