A query on Akka stream with Spring


(Mghildiy) #1

I am following this link:

akka streams documentation.

It states operators(Source, Flow,Sink) are building blocks to create a blueprint/setup. To actually trigger stream, we need to call run method.
But in my webservice end point(spring+Alpakka), I have just this:

return Source.from(myIterator);

Accessing endpoint in browser fetches me the result. Why is run method not needed here?


(Martynas Mickevičius) #2

Hi,

the Alpakka Spring Web connector runs the stream, therefore you need to give it the blueprint.


(Mghildiy) #3

OK. So using Alpakka means I dont need to explicitly call run. One just needs to make blueprint.


(Martynas Mickevičius) #4

For the particular Alpakka Spring Web connector, yes, that is true. However that is more of an exception that the rule. Most other Alpakka connectors provide blueprints and leave the responsibility to the user to run them.