Skip to content

Instantly share code, notes, and snippets.

View dembol's full-sized avatar

Łukasz Dembiński dembol

View GitHub Profile
@dembol
dembol / GroupedWithList.scala
Created September 14, 2018 15:21
Akka grouped stage using a List
import akka.stream._
import akka.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
import scala.collection.immutable
final case class GroupedWithList[T](n: Int) extends GraphStage[FlowShape[T, immutable.Seq[T]]] {
require(n > 0, "n must be greater than 0")
val in = Inlet[T]("Grouped.in")
val out = Outlet[immutable.Seq[T]]("Grouped.out")