SlideShare a Scribd company logo
Akka Stream
Sonu Mehrotra
Software Consultant
Knoldus Software LLP
Agenda
1) What is Akka Stream ?
2) Components of Akka Stream.
3) Working with Graphs.
4) Error handling.
5) Testing Streams.
Akka Stream
There are two basic problems with data processing -
1) Blocking (Pull Based System)
2) Back Pressure (Push Based System)
Akka Streams is a toolkit for processing of streams. It is an
implementation of Reactive Streams Specification. Its purpose
is to “formulate stream processing setups such that we can
then execute them efficiently and with bounded resource
usage.”
Components of Akka Streams
There are three main components of Akka Streams -
1) Source
2) Flow
3) Sink
Source
Source is a “processing stage with exactly one output,
emitting data elements whenever downstream
processing stages are ready to receive them.”
●
Various Sources -
Sink
Sink is a “processing stage with exactly one input,
requesting and accepting data elements possibly slowing
down the upstream producer of elements.”
Various Sinks -
Flow
Flow is a “processing stage which has exactly one input
and output, which connects its up- and down streams by
transforming the data elements flowing through it.”
Various Flows -
Working with Graphs
Graphs are built from simple Flows which serve as the
linear connections within the graphs as well as junctions
which serve as fan-in and fan-out points for Flows.
Various Junctions provided by Akka Streams -
●
Fan-out Junctions
●
Fan-in Junctions
Fan-out Junctions
Fan-out operations give us the ability to split a stream
into sub-streams.
●
Broadcast[T] – (1 input, N outputs)
Ingests elements from one input and emits duplicated
events across more than one output.
●
Balance[T] – (1 input, N outputs)
Ingests elements from one input and emits to the first
available output port.
Fan-in Junctions
Fan-in operations give us the ability to join multiple streams into a single
output stream.
●
Merge[In] – (N inputs , 1 output)
Picks randomly from inputs pushing them one by one to its output.
●
MergePreferred[In]
Similar to Merge but if elements are available on preferred port, it picks
from it, otherwise randomly from others.
●
Concat[A] – (2 inputs, 1 output)
Concatenates two streams (first consume one, then the second one)
Error Handling
Strategies for how to handle exceptions from processing stream
elements can be defined when materializing the stream.
There are three ways to handle Exceptions -
●
Stop – The stream is completed with failure.
●
Resume – The element is dropped and the stream continues.
●
Restart - The element is dropped and the stream continues after
restarting the stage. Restarting a stage means that any accumulated
state is cleared.
Testing Streams
There are 3 ways to test the stream -
●
Simple sources, sinks and flows.
●
Sources and Sinks in combination with TestProbe from
the akka-testkit module.
●
Sources and Sinks specifically crafted for writing tests
from the akka-stream-testkit module.
References
[1] Akka Streams Documentation
[2] Lightbend Activator
[3] Opencredo Blog
Thank you !

More Related Content

PDF
Akka streams
PDF
Akka streams scala italy2015
PDF
Akka Streams and HTTP
PDF
Journey into Reactive Streams and Akka Streams
PPTX
How to manage large amounts of data with akka streams
PPTX
Stream processing from single node to a cluster
PDF
Reactive Stream Processing with Akka Streams
PPTX
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...
Akka streams
Akka streams scala italy2015
Akka Streams and HTTP
Journey into Reactive Streams and Akka Streams
How to manage large amounts of data with akka streams
Stream processing from single node to a cluster
Reactive Stream Processing with Akka Streams
Back-Pressure in Action: Handling High-Burst Workloads with Akka Streams & Ka...

What's hot (20)

PPTX
Dive into spark2
PDF
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
PPTX
Spark real world use cases and optimizations
PPT
Introduction to Spark Streaming
PDF
Akka Streams
PPTX
JVM languages "flame wars"
PDF
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
PDF
Practical Akka HTTP - introduction
PDF
Flink Forward SF 2017: Joe Olson - Using Flink and Queryable State to Buffer ...
PDF
Flink Forward SF 2017: Dean Wampler - Streaming Deep Learning Scenarios with...
PDF
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...
PDF
Reactive Streams 1.0 and Akka Streams
PPTX
Flink Forward SF 2017: Shaoxuan Wang_Xiaowei Jiang - Blinks Improvements to F...
PDF
Developing Secure Scala Applications With Fortify For Scala
PDF
Flink Forward SF 2017: Feng Wang & Zhijiang Wang - Runtime Improvements in Bl...
ODP
Introduction to Structured Streaming
PDF
Patterns of the Lambda Architecture -- 2015 April -- Hadoop Summit, Europe
PDF
Building scalable rest service using Akka HTTP
PDF
Revitalizing Enterprise Integration with Reactive Streams
PPT
Spark stream - Kafka
Dive into spark2
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
Spark real world use cases and optimizations
Introduction to Spark Streaming
Akka Streams
JVM languages "flame wars"
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Practical Akka HTTP - introduction
Flink Forward SF 2017: Joe Olson - Using Flink and Queryable State to Buffer ...
Flink Forward SF 2017: Dean Wampler - Streaming Deep Learning Scenarios with...
Flink Forward SF 2017: Malo Deniélou - No shard left behind: Dynamic work re...
Reactive Streams 1.0 and Akka Streams
Flink Forward SF 2017: Shaoxuan Wang_Xiaowei Jiang - Blinks Improvements to F...
Developing Secure Scala Applications With Fortify For Scala
Flink Forward SF 2017: Feng Wang & Zhijiang Wang - Runtime Improvements in Bl...
Introduction to Structured Streaming
Patterns of the Lambda Architecture -- 2015 April -- Hadoop Summit, Europe
Building scalable rest service using Akka HTTP
Revitalizing Enterprise Integration with Reactive Streams
Spark stream - Kafka
Ad

Viewers also liked (20)

ODP
Introduction to Scala JS
ODP
Drilling the Async Library
ODP
Getting Started With AureliaJs
ODP
Realm Mobile Database - An Introduction
ODP
Mailchimp and Mandrill - The ‘Hominidae’ kingdom
ODP
String interpolation
PDF
Kanban
ODP
Shapeless- Generic programming for Scala
ODP
An Introduction to Quill
ODP
Introduction to Java 8
ODP
Introduction to Scala Macros
ODP
Mandrill Templates
ODP
Functors, Applicatives and Monads In Scala
ODP
Effective way to code in Scala
ODP
Introduction to Knockout Js
ODP
Introduction to ScalaZ
ODP
ANTLR4 and its testing
ODP
HTML5, CSS, JavaScript Style guide and coding conventions
ODP
Functional programming in Javascript
ODP
MongoDB: Advance concepts - Replication and Sharding
Introduction to Scala JS
Drilling the Async Library
Getting Started With AureliaJs
Realm Mobile Database - An Introduction
Mailchimp and Mandrill - The ‘Hominidae’ kingdom
String interpolation
Kanban
Shapeless- Generic programming for Scala
An Introduction to Quill
Introduction to Java 8
Introduction to Scala Macros
Mandrill Templates
Functors, Applicatives and Monads In Scala
Effective way to code in Scala
Introduction to Knockout Js
Introduction to ScalaZ
ANTLR4 and its testing
HTML5, CSS, JavaScript Style guide and coding conventions
Functional programming in Javascript
MongoDB: Advance concepts - Replication and Sharding
Ad

Similar to Akka streams (20)

PDF
Akka stream and Akka CQRS
ODP
Introduction to Akka Streams [Part-I]
PDF
VJUG24 - Reactive Integrations with Akka Streams
PDF
Getting Started with Akka Streams
PDF
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
PDF
Akka Streams - From Zero to Kafka
PDF
Introduction to Akka Streams
PDF
Reactive Streams / Akka Streams - GeeCON Prague 2014
PDF
Reactive integrations with Akka Streams
ODP
Introduction to Akka Streams [Part-II]
PDF
Scala usergroup stockholm - reactive integrations with akka streams
PDF
Reactive Streams: Handling Data-Flow the Reactive Way
PDF
Streaming all the things with akka streams
PDF
Exploring Reactive Integrations With Akka Streams, Alpakka And Apache Kafka
PDF
A Tour of Akka Streams
PDF
A Tour of Akka-Streams
PDF
Asynchronous stream processing with Akka Streams
PPTX
Akka.NET streams and reactive streams
PDF
Reactive Streams, j.u.concurrent, & Beyond!
PDF
Akka Streams in Action @ ScalaDays Berlin 2016
Akka stream and Akka CQRS
Introduction to Akka Streams [Part-I]
VJUG24 - Reactive Integrations with Akka Streams
Getting Started with Akka Streams
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
Akka Streams - From Zero to Kafka
Introduction to Akka Streams
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive integrations with Akka Streams
Introduction to Akka Streams [Part-II]
Scala usergroup stockholm - reactive integrations with akka streams
Reactive Streams: Handling Data-Flow the Reactive Way
Streaming all the things with akka streams
Exploring Reactive Integrations With Akka Streams, Alpakka And Apache Kafka
A Tour of Akka Streams
A Tour of Akka-Streams
Asynchronous stream processing with Akka Streams
Akka.NET streams and reactive streams
Reactive Streams, j.u.concurrent, & Beyond!
Akka Streams in Action @ ScalaDays Berlin 2016

More from Knoldus Inc. (20)

PPTX
Angular Hydration Presentation (FrontEnd)
PPTX
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
PPTX
Self-Healing Test Automation Framework - Healenium
PPTX
Kanban Metrics Presentation (Project Management)
PPTX
Java 17 features and implementation.pptx
PPTX
Chaos Mesh Introducing Chaos in Kubernetes
PPTX
GraalVM - A Step Ahead of JVM Presentation
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
DAPR - Distributed Application Runtime Presentation
PPTX
Introduction to Azure Virtual WAN Presentation
PPTX
Introduction to Argo Rollouts Presentation
PPTX
Intro to Azure Container App Presentation
PPTX
Insights Unveiled Test Reporting and Observability Excellence
PPTX
Introduction to Splunk Presentation (DevOps)
PPTX
Code Camp - Data Profiling and Quality Analysis Framework
PPTX
AWS: Messaging Services in AWS Presentation
PPTX
Amazon Cognito: A Primer on Authentication and Authorization
PPTX
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
PPTX
Managing State & HTTP Requests In Ionic.
Angular Hydration Presentation (FrontEnd)
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Self-Healing Test Automation Framework - Healenium
Kanban Metrics Presentation (Project Management)
Java 17 features and implementation.pptx
Chaos Mesh Introducing Chaos in Kubernetes
GraalVM - A Step Ahead of JVM Presentation
Nomad by HashiCorp Presentation (DevOps)
Nomad by HashiCorp Presentation (DevOps)
DAPR - Distributed Application Runtime Presentation
Introduction to Azure Virtual WAN Presentation
Introduction to Argo Rollouts Presentation
Intro to Azure Container App Presentation
Insights Unveiled Test Reporting and Observability Excellence
Introduction to Splunk Presentation (DevOps)
Code Camp - Data Profiling and Quality Analysis Framework
AWS: Messaging Services in AWS Presentation
Amazon Cognito: A Primer on Authentication and Authorization
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Managing State & HTTP Requests In Ionic.

Recently uploaded (20)

PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
top salesforce developer skills in 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
AI in Product Development-omnex systems
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Digital Strategies for Manufacturing Companies
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Online Work Permit System for Fast Permit Processing
Upgrade and Innovation Strategies for SAP ERP Customers
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Odoo POS Development Services by CandidRoot Solutions
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Adobe Illustrator 28.6 Crack My Vision of Vector Design
top salesforce developer skills in 2025.pdf
PTS Company Brochure 2025 (1).pdf.......
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
AI in Product Development-omnex systems
Navsoft: AI-Powered Business Solutions & Custom Software Development
Digital Strategies for Manufacturing Companies
Design an Analysis of Algorithms II-SECS-1021-03
2025 Textile ERP Trends: SAP, Odoo & Oracle
How to Migrate SBCGlobal Email to Yahoo Easily
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
How Creative Agencies Leverage Project Management Software.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Online Work Permit System for Fast Permit Processing

Akka streams

  • 1. Akka Stream Sonu Mehrotra Software Consultant Knoldus Software LLP
  • 2. Agenda 1) What is Akka Stream ? 2) Components of Akka Stream. 3) Working with Graphs. 4) Error handling. 5) Testing Streams.
  • 3. Akka Stream There are two basic problems with data processing - 1) Blocking (Pull Based System) 2) Back Pressure (Push Based System) Akka Streams is a toolkit for processing of streams. It is an implementation of Reactive Streams Specification. Its purpose is to “formulate stream processing setups such that we can then execute them efficiently and with bounded resource usage.”
  • 4. Components of Akka Streams There are three main components of Akka Streams - 1) Source 2) Flow 3) Sink
  • 5. Source Source is a “processing stage with exactly one output, emitting data elements whenever downstream processing stages are ready to receive them.” ● Various Sources -
  • 6. Sink Sink is a “processing stage with exactly one input, requesting and accepting data elements possibly slowing down the upstream producer of elements.” Various Sinks -
  • 7. Flow Flow is a “processing stage which has exactly one input and output, which connects its up- and down streams by transforming the data elements flowing through it.” Various Flows -
  • 8. Working with Graphs Graphs are built from simple Flows which serve as the linear connections within the graphs as well as junctions which serve as fan-in and fan-out points for Flows. Various Junctions provided by Akka Streams - ● Fan-out Junctions ● Fan-in Junctions
  • 9. Fan-out Junctions Fan-out operations give us the ability to split a stream into sub-streams. ● Broadcast[T] – (1 input, N outputs) Ingests elements from one input and emits duplicated events across more than one output. ● Balance[T] – (1 input, N outputs) Ingests elements from one input and emits to the first available output port.
  • 10. Fan-in Junctions Fan-in operations give us the ability to join multiple streams into a single output stream. ● Merge[In] – (N inputs , 1 output) Picks randomly from inputs pushing them one by one to its output. ● MergePreferred[In] Similar to Merge but if elements are available on preferred port, it picks from it, otherwise randomly from others. ● Concat[A] – (2 inputs, 1 output) Concatenates two streams (first consume one, then the second one)
  • 11. Error Handling Strategies for how to handle exceptions from processing stream elements can be defined when materializing the stream. There are three ways to handle Exceptions - ● Stop – The stream is completed with failure. ● Resume – The element is dropped and the stream continues. ● Restart - The element is dropped and the stream continues after restarting the stage. Restarting a stage means that any accumulated state is cleared.
  • 12. Testing Streams There are 3 ways to test the stream - ● Simple sources, sinks and flows. ● Sources and Sinks in combination with TestProbe from the akka-testkit module. ● Sources and Sinks specifically crafted for writing tests from the akka-stream-testkit module.
  • 13. References [1] Akka Streams Documentation [2] Lightbend Activator [3] Opencredo Blog