Some advice needed on refactoring from Camel to Alpakka JMS

(Marcel Koopman) #1

I’ve implemented a Camel route for consuming JMS.
Using Camel i am also able to suspend the route and to adjust the delay/throttle of consuming.
Now I wanted to switch over to Alpakka but I run into some issues:

  1. recreate sources or not? the killswitch on the jms source, i can use this to suspend the consuming by killing and making a new source, but I could loose some messages, it this a good idea?
  2. It is possible to create a dynamic throttle mechanism of even a suspend on a jms source?

(Martynas Mickevičius) #2

Managing the flow of the stream in Akka Stream land is done via backpressure. If the downstream consumer is slow, then upstream will backpressure and stop producing elements.

Most of the Akka Stream operators handle backpressure automatically. But there are some, where you can control it manually like Sink.actorRefWithAck where messages will not be sent from the stream to an Actor until the already sent ones are acknowledged. Therefore by stopping ack’ing incoming messages you can effectively slow down the stream.