title: Closing an Akka stream from inside a GraphStage (Akka 2.4.2)
body: <p>In Akka Stream 2.4.2, PushStage has been deprecated. For Streams 2.0.3 I was using the solution from this answer:</p>
  
  <p><a href="https://stackoverflow.com/questions/34954144/how-does-one-close-an-akka-stream">How does one close an Akka stream?</a></p>
  
  <p>which was:</p>
  
  <pre><code>import akka.stream.stage._
  
      val closeStage = new PushStage[Tpe, Tpe] {
        override def onPush(elem: Tpe, ctx: Context[Tpe]) = elem match {
          case elem if shouldCloseStream ⇒
            // println("stream closed")
            ctx.finish()
          case elem ⇒
            ctx.push(elem)
        }
      }
  </code></pre>
  
  <p>How would I close a stream in 2.4.2 immediately, from inside a GraphStage / onPush() ?</p>