pekko/akka-docs/src/test/scala/docs/stream/cookbook/RecipeKeepAlive.scala
Roman Filonenko 8fcf728b7a fix Trigger references in the stream cookbook example for digest #24317
* replace Trigger with Unit
 * cosmetic changes in docs.stream.cookbook tests
2018-03-03 08:52:02 +01:00

24 lines
579 B
Scala

package docs.stream.cookbook
import akka.NotUsed
import akka.stream.scaladsl._
import akka.util.ByteString
class RecipeKeepAlive extends RecipeSpec {
"Recipe for injecting keepalive messages" must {
"work" in {
val keepaliveMessage = ByteString(11)
//#inject-keepalive
import scala.concurrent.duration._
val injectKeepAlive: Flow[ByteString, ByteString, NotUsed] =
Flow[ByteString].keepAlive(1.second, () keepaliveMessage)
//#inject-keepalive
// No need to test, this is a built-in stage with proper tests
}
}
}