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
227
votes
1 answer

How to get started with Akka Streams?

The Akka Streams library already comes with quite a wealth of documentation. However, the main problem for me is that it provides too much material - I feel quite overwhelmed by the number of concepts that I have to learn. Lots of examples shown…
kiritsuku
  • 52,967
  • 18
  • 114
  • 136
62
votes
3 answers

How to create a Source that can receive elements later via a method call?

I would like to create a Source and later push elements on it, like in: val src = ... // create the Source here // and then, do something like this pushElement(x1, src) pushElement(x2, src) What is the recommended way to do this? Thanks!
ale64bit
  • 6,232
  • 3
  • 24
  • 44
49
votes
5 answers

Akka Stream Kafka vs Kafka Streams

I am currently working with Akka Stream Kafka to interact with kafka and I was wonderings what were the differences with Kafka Streams. I know that the Akka based approach implements the reactive specifications and handles back-pressure,…
33
votes
1 answer

Via/ViaMat/to/toMat in Akka Stream

Can someone explain clearly what are the difference between those 4 methods ? When is it more appropriate to use each one ? Also generally speaking what is the name of this Group of method? Are there more method that does the same job ? A link to…
MaatDeamon
  • 9,532
  • 9
  • 60
  • 127
33
votes
3 answers

How to convert Source[ByteString, Any] to InputStream

akka-http represents a file uploaded using multipart/form-data encoding as Source[ByteString, Any]. I need to unmarshal it using Java library that expects an InputStream. How Source[ByteString, Any] can be turned into an InputStream?
kostya
  • 9,221
  • 1
  • 29
  • 36
32
votes
1 answer

In project reactor or akka streams, what is the conceptual difference between sink and subscriber?

The concepts of sink and subscriber seem similar to me. Also, I don't see the concept of sink being explicitly defined in the reactive streams spec.
Jatin
  • 667
  • 8
  • 16
30
votes
3 answers

Accessing the underlying ActorRef of an akka stream Source created by Source.actorRef

I'm trying to use the Source.actorRef method to create an akka.stream.scaladsl.Source object. Something of the form import akka.stream.OverflowStrategy.fail import akka.stream.scaladsl.Source case class Weather(zip : String, temp : Double, raining…
Ramón J Romero y Vigil
  • 17,373
  • 7
  • 77
  • 125
27
votes
1 answer

Akka stream 2.6. How to create ActorMaterializer?

Since 2.6 i get deprecation warning on this line: import akka.stream.ActorMaterializer implicit val actorMaterializer = ActorMaterializer() Warning: method apply in object ActorMaterializer is deprecated (since 2.6.0): Use the system wide…
Alexander Kondaurov
  • 3,677
  • 5
  • 42
  • 64
25
votes
3 answers

How to add elements to Source dynamically?

I have example code to generate an unbound source and working with it: object Main { def main(args : Array[String]): Unit = { implicit val system = ActorSystem("Sys") import system.dispatcher implicit val materializer =…
krynio
  • 2,442
  • 26
  • 30
24
votes
3 answers

How to create an akka-stream Source from a Flow that generate values recursively?

I need to traverse an API that is shaped like a tree. For example, a directory structure or threads of discussion. It can be modeled via the following flow: type ItemId = Int type Data = String case class Item(data: Data, kids: List[ItemId]) def…
Guillaume Massé
  • 8,004
  • 8
  • 44
  • 57
24
votes
3 answers

Creating a flow from actor in Akka Streams

It's possible to create sources and sinks from actors using Source.actorPublisher() and Sink.actorSubscriber() methods respectively. But is it possible to create a Flow from actor? Conceptually there doesn't seem to be a good reason not to, given…
Ori Popowski
  • 10,432
  • 15
  • 57
  • 79
22
votes
1 answer

Akka Streams: What does Mat represents in Source[out, Mat]

In Akka streams what does Mat in Source[Out, Mat] or Sink[In, Mat] represent. When will it actually be used?
Somasundaram Sekar
  • 5,244
  • 6
  • 43
  • 85
22
votes
2 answers

akka http: Akka streams vs actors to build a rest service

When it comes to creating a REST web service with 60+ API on akka http. How can I choose whether I should go with akka streams or akka actors? In his post, Jos shows two ways to create an API on akka http but he doesn't show when I should select one…
Mutaz
  • 547
  • 4
  • 12
21
votes
2 answers

Akka Streams: State in a flow

I want to read multiple big files using Akka Streams to process each line. Imagine that each key consists of an (identifier -> value). If a new identifier is found, I want to save it and its value in the database; otherwise, if the identifier has…
vicaba
  • 2,836
  • 1
  • 27
  • 45
21
votes
2 answers

akka stream toMat

I am trying to understand what does toMat in akka streaming. For example: val sink1:Sink[Int, Future[Int]]=Sink.fold[Int,Int](0)(_ + _) val flow=Flow[Int].fold[Int](0){(x,y)=> x+y} val runnable = Source (1 to…
ASe
  • 535
  • 5
  • 15
1
2 3
99 100