A query on Akka stream with Spring

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?

Hi,

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

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

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.

1 Like