Skip to content

Instantly share code, notes, and snippets.

@abdolence
Created February 11, 2020 22:13
Show Gist options
  • Save abdolence/648886f76a37656818e37dab186d557f to your computer and use it in GitHub Desktop.
Save abdolence/648886f76a37656818e37dab186d557f to your computer and use it in GitHub Desktop.
package fizzbuzz
import cloudflow.akkastream._
import cloudflow.akkastream.scaladsl._
import cloudflow.streamlets._
import cloudflow.streamlets.avro._
class FizzBuzzPrinter extends AkkaStreamlet {
val inlet = AvroInlet[FizzBuzzResult]( "in" )
val shape = StreamletShape.withInlets( inlet )
override def createLogic = new RunnableGraphStreamletLogic() {
def flow = {
FlowWithOffsetContext[FizzBuzzResult]
.map { result ⇒
system.log.info( result.toString )
result
}
}
def runnableGraph = {
sourceWithOffsetContext( inlet ).via( flow ).to( sinkWithOffsetContext )
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment