lunatech-labs/lunatech-streams-in-scala

★ 0Forks 0ScalaGitHub ↗Compare

README

Streams in Scala

This is a sample project that accompanies the blog post Streams in Scala.


A simple application that reads log files and prints the lines to the console using scala LazyList (LogStream), Akka Stream and Fs2 Stream. The project is divided into three parts:
1. LogStream: This is just an abstraction wrapping LazyList to resists the temptation to use LazyList methods that can cause memory leaks.
2. AkkaStream: Here we use Akka Stream to read the log files and print the lines to the console.
3. Fs2Stream: Here we use Fs2 Stream to read the log files and print the lines to the console.

How to run the application

  1. Using the following command: sbt run, you would be asked to select the stream type to use, available options are:
[(LogStream->l), (AkkaStream->a), (fs2Stream->f)]
  1. Pick the letter l to use LogStream.
  2. choose wether to use filter or by line number, available options are:
[(filter->f), (line number->l)]
  1. Pick the letter f to use filter.
  2. Enter the filter string, check your log files to pick a filter string, for example: ERROR.
  3. The program will print the lines that contain the filter string to the console after reading the log files with the time taken.
  4. Repeat the process to use the other stream types.

Contributors

zanio

Issues