Questions tagged [akka-stream]

Akka implementation for handling streaming data on the JVM

Akka implementation of reactive-streams standard for handling streaming data on the .

This library uses Akka Actor based transformations of data streams which proceed as a series of steps which can be executed in parallel, in a pipelined fashion.

More info:

1741 questions
13
votes
1 answer

Error in graph create: requirement failed: The inlets [] and outlets [] must correspond to the inlets [in] and outlets [out]

I'm using akka streams graphDSL to create a runnable graph. There are no compile-time errors wrt inlet / outlet of the stream components. Runtime throws following error: Any ideas what should I verify to make it run ? requirement failed: The inlets…
phantomastray
  • 449
  • 3
  • 16
13
votes
2 answers

What is the right way to work with slick's 3.0.0 streaming results and Postgresql?

I am trying to figure out how to work with slick streaming. I use slick 3.0.0 with postgres driver The situation is following: server have to give client sequences of data split into chunks limited by size(in bytes). So, I wrote following slick…
12
votes
1 answer

akka stream asyncBoundary vs mapAsync

I am trying to understand the difference between asyncBoundary and mapAsync. From the glance, I guess they should be same. However, when I run the code, it looks like that the performance of asyncBoundary is quicker than mapAsync Here is the…
Xiaohe Dong
  • 4,953
  • 6
  • 24
  • 53
12
votes
2 answers

Why does this simple Akka Streams program never terminate?

Should be a simple question. I'm using Akka 2.4.2 (contains Akka Streams & HTTP). I expected this Source to complete & the program to terminate because the Source is finite, but it never does. Why doesn't this program terminate? import…
Matthew Adams
  • 2,059
  • 2
  • 21
  • 31
12
votes
2 answers

How to download a HTTP resource to a file with Akka Streams and HTTP?

Over the past few days I have been trying to figure out the best way to download a HTTP resource to a file using Akka Streams and HTTP. Initially I started with the Future-Based Variant and that looked something like this: def…
steinybot
  • 5,491
  • 6
  • 37
  • 55
12
votes
4 answers

How to split an inbound stream on a delimiter character using Akka Streams

I've been playing around with the experimental Akka Streams API a bit and I have a use case that I wanted to see how to implement. For my use case, I have a StreamTcp based Flow that is being fed from binding the input stream of connections to my…
cmbaxter
  • 35,283
  • 4
  • 86
  • 95
11
votes
1 answer

akka-stream + akka-http lifecycle

TLDR: is it better to materialize a stream per request (i.e. use short-lived streams) or to use a single stream materialization across requests, when I have an outgoing http request as a part of the stream? Details: I have a typical service that…
Tim
  • 2,008
  • 16
  • 22
11
votes
1 answer

How do you deal with futures in Akka Flow?

I have built an akka graph that defines a flow. My objective is to reformat my future response and save it to a file. The flow can be outlined bellow: val g = RunnableGraph.fromGraph(GraphDSL.create() { implicit builder: GraphDSL.Builder[NotUsed]…
Dr.Knowitall
  • 10,080
  • 23
  • 82
  • 133
11
votes
4 answers

Handle Akka stream's first element specially

Is there an idiomatic way of handling Akka stream's Source first element in a special way? What I have now is: var firstHandled = false source.map { elem => if(!firstHandled) { //handle specially firstHandled = true …
povder
  • 187
  • 1
  • 12
11
votes
1 answer

How to use Akka-HTTP client websocket send message

I'm trying client-side websocket by following doc at webSocketClientFlow. sample code is: import akka.actor.ActorSystem import akka.Done import akka.http.scaladsl.Http import akka.stream.ActorMaterializer import akka.stream.scaladsl._ import…
xring
  • 727
  • 2
  • 8
  • 29
11
votes
1 answer

Alternative flows based on condition for akka stream

Have a stream with custom flows and at a certain stage I want to split the stream and have two alternative data handling which will merge again later. E.g. -> F3 -> F6 Src -> F1 -> F2 > Merge -> Sink …
LK__
  • 6,515
  • 5
  • 34
  • 53
11
votes
1 answer

How can I publish or subscribe to a materialized Akka Stream flow graph?

I'm playing around with Akka Stream and I'm trying to figure out its flexibility after materialization. One way to do so is to use the low level reactive streams…
Ruurtjan Pul
  • 1,197
  • 1
  • 10
  • 21
10
votes
1 answer

Akka-streams: how to get flow names in metrics reported by kamon-akka

I've been trying to set-up some instrumentation for Akka streams. Got it working, but, even though I named all my Flows that are part of the streams, I still get this sort of names in the metrics: flow-0-0-unknown-operation A simple example of what…
sbrnunes
  • 119
  • 7
10
votes
3 answers

How are reactive streams used in Slick for inserting data

In Slick's documentation examples for using Reactive Streams are presented just for reading data as a means of a DatabasePublisher. But what happens when you want to use your database as a Sink and backpreasure based on your insertion rate? I've…
tonicebrian
  • 4,715
  • 5
  • 41
  • 65
10
votes
2 answers

akka-http: complete request with flow

Assume I have set up an arbitrarily complex Flow[HttpRequest, HttpResponse, Unit]. I can already use said flow to handle incoming requests with Http().bindAndHandle(flow, "0.0.0.0", 8080) Now I would like to add logging, leveraging some existing…
Stefano Bonetti
  • 8,973
  • 1
  • 25
  • 44