Skip to Content
Scala Reactive Programming
book

Scala Reactive Programming

by Rambabu Posa
February 2018
Intermediate to advanced
552 pages
13h 46m
English
Packt Publishing
Content preview from Scala Reactive Programming

HelloWorld example description

We will dissect each step one by one to understand the basics of Akka Streams components.

  1. Create a Akka Streams Source as follows:
      val helloWorldSource = Source.single("Akka Streams Hello World")

Here, we create the Akka Streams Hello World text message as a Source for this application. We can use the Source.single function to create a Source with one element.

The type annotation of the Source.single function is Source[T,NotUsed], where T is the string in our example. So we can also write the preceding code snippet as follows:

      val helloWorldSource:Source[String,NotUsed] =        Source.single("Akka Streams Hello World")

NotUsed is a sealed abstract class and has one case object, as shown here:

 sealed abstract ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Scala Programming Projects

Scala Programming Projects

Mikael Valot, Nicolas Jorand
Learning Scala

Learning Scala

Jason Swartz
Functional Programming in Scala

Functional Programming in Scala

Runar Bjarnason, Paul Chiusano

Publisher Resources

ISBN: 9781787288645Supplemental Content