* Add CopyrightHeader support for sbt-boilerplate plugin. * Add CopyrightHeader support for `*.proto` files. * Add regex match for both `–` and `-` for CopyrightHeader. * Add CopyrightHeader support for sbt build files. * Update copyright from 2018 to 2019.
28 lines
657 B
Scala
28 lines
657 B
Scala
/*
|
|
* Copyright (C) 2018-2019 Lightbend Inc. <https://www.lightbend.com>
|
|
*/
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
}
|