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
7
votes
2 answers

Akka Streams: how to wait until several Flows are completed

I have several Flows in my program, that I would like to process in parallel. After all are completed, I would like to trigger some action. One way of doing it would be to send a message to an Actor after each completion, and when the Actor verifies…
Eduardo
  • 8,362
  • 6
  • 38
  • 72
6
votes
1 answer

Akka streams pass through flow limiting Parallelism / throughput of processing flow

I have a use case where I want to send a message to an external system but the flow that sends this message takes and returns a type I cant use downstream. This is a great use case for the pass through flow. I am using the implementation here.…
Luke De Feo
  • 2,025
  • 3
  • 22
  • 40
6
votes
1 answer

Why adding async boundary in Akka Streams costs a lot of CPU?

I've found that my Akka Streams program had unexpected CPU usage. Here is a simple example: import akka.actor.ActorSystem import akka.stream.ActorMaterializer import akka.stream.scaladsl.{Sink, Source} implicit val system: ActorSystem =…
lxohi
  • 350
  • 2
  • 11
6
votes
1 answer

Count number of elements in Akka Streams

I'm trying to transform a Source of Scala entities into a Source of ByteString via Alpakka's CsvFormatting and count number of elements in the initial stream. Could you suggest the best way to count the initialSource elements and keep the result as…
noname.404
  • 335
  • 3
  • 11
6
votes
2 answers

Akka Stream - Select Sink based on Element in Flow

I'm creating a simple message delivery service using Akka stream. The service is just like mail delivery, where elements from source include destination and content like: case class Message(destination: String, content: String) and the service…
gyoho
  • 799
  • 2
  • 9
  • 25
6
votes
2 answers

Http Websocket as Akka Stream Source

I'd like to listen on a websocket using akka streams. That is, I'd like to treat it as nothing but a Source. However, all official examples treat the websocket connection as a Flow. My current approach is using the websocketClientFlow in combination…
Rea Sand
  • 163
  • 9
6
votes
2 answers

Multiple sinks in the same stream

I have a stream like this and two sinks, but only one is used at a time: Source.fromElements(1, 2, 3) .via(flow) .runWith(sink1) or Source.fromElements(1, 2, 3) .via(flow) .runWith(sink2) It is configurable which sink we use, but what if I have…
Piotr Kozlowski
  • 899
  • 1
  • 13
  • 25
6
votes
1 answer

How to compose two Flows side-by-side?

Is there an Akka streams combinator for doing the following (or something to that effect)? (Let's call it and for now.) (flow1: Flow[I, O, Mat]).and[O2](flow2: Flow[I, O2, Mat]): Flow[I, (O, O2), Mat] The semantics would be that whatever the…
missingfaktor
  • 90,905
  • 62
  • 285
  • 365
6
votes
3 answers

What does Keep in akka stream mean?

I am learning akka stream and encounter Keep.left and Keep.right in the code: implicit val system = ActorSystem("KafkaProducer") implicit val materializer = ActorMaterializer() val source = Source(List("a", "b", "c")) val sink = Sink.fold[String,…
softshipper
  • 32,463
  • 51
  • 192
  • 400
6
votes
2 answers

How do I extract a Future[String] from an akka Source[ByteString, _]?

I am attempting to stream a file using akka streams and am running into a small issue extracting the results of the stream into a Future[String]: def streamMigrationFile(source: Source[ByteString, _]): Future[String] = { var fileString = "" val…
Reece Long
  • 437
  • 1
  • 4
  • 13
6
votes
0 answers

Streaming data with Akka Streams , Play Framework and MongoDB Reactive not working

Following up from this question: Play Framework 2.5 Streaming content with delay I have been trying to stream data from MongoDB Reactive through Akka Streams and Play Framework. The problem is that for some reason the data collects first and then…
Jerry Hu
  • 135
  • 1
  • 1
  • 5
6
votes
2 answers

Decode chunked JSON with AKKA Stream

I have a Source[ByteString, _] from an input file with 3 rows like this (in reality the input is a TCP socket with a continuos stream): {"a":[2 33] } Now the problem is that I want to parse this into a Source[ChangeMessage,_], however the only…
user3139545
  • 6,882
  • 13
  • 44
  • 87
6
votes
4 answers

Websocket Proxy using Play 2.6 and akka streams

I'm trying to create a simple Proxy for Websocket connections using Play and akka streams. The traffic flow is like this: (Client) request -> -> request (Server) Proxy (Client) response <- <- response…
morgan freeman
  • 6,041
  • 3
  • 25
  • 32
6
votes
2 answers

Is connection pooling in akka-http using the source queue Implementation thread safe?

Refering to the following implementation mentioned in: http://doc.akka.io/docs/akka-http/10.0.5/scala/http/client-side/host-level.html val poolClientFlow = Http().cachedHostConnectionPool[Promise[HttpResponse]]("akka.io") val queue = …
Niv-Nik
  • 61
  • 2
6
votes
1 answer

Can the subflows of groupBy depend on the keys they were generated from ?

I have a flow with data associated to users. I also have a state for each user, that I can get asynchronously from DB. I want to separate my flow with one subflow per user, and load the state for each user when materializing the subflow, so that the…
Cyrille Corpet
  • 5,265
  • 1
  • 14
  • 31