Alpakka jms consumer throttle option

Hello,
We are using Alpakka jms consumer (“com.lightbend.akka” %% “akka-stream-alpakka-jms” % “2.0.2”).
We are facing a few challenges with our design.

Background : Our microservice has alpakka jms consumer and uses akka actor system to pass on messages to different actor.

Problem : Problem is alpakka consumer is reading messages from queue and calling actor.tell(message, self), this is the only thing this consumer is doing.
Now the actor which is receiving these messages does lots of processing and finally writes to different queue. This processing time is longer as it involves calling different microservice (http based).
After processing is done final message is written to different queue. This writing to different queue logic uses circuit breaker. So when volume is high this circuit breaker is getting opened, which is causing failures.

Is there a away to throtle or limit number of messages to be read from queue in jms consumer ? or any other suggestions is much appreciated ?

Thanks
Ali

Hi @aliqamer. You may want to consider using backpressure to throttle your stream back to your Alpakka JMS source by using the ask pattern (Flow.ask operator) to send messages to your processing actor and then send the reply to the next JMS queue.

Hi @seglo,
Thanks for your reply. I used source.throttle() function on my jmssource by throttling few msg per second.
This fixed my problem.
with regards,
Ali