Skip to content

Instantly share code, notes, and snippets.

@adamw
Created June 10, 2018 14:16
Show Gist options
  • Save adamw/23853ebd6d248a4e015fc3120561ebbc to your computer and use it in GitHub Desktop.
Save adamw/23853ebd6d248a4e015fc3120561ebbc to your computer and use it in GitHub Desktop.
class ConsumeQueueActor(connector: QueueConnector[Future])
extends Actor with ActorLogging {
import context.dispatcher
private var currentQueue: Option[Queue[Future]] = None
override def preStart(): Unit = // ...
override def postStop(): Unit = {
log.info("[queue-stop] stopping queue actor")
currentQueue.foreach { queue =>
log.info("[queue-stop] closing")
Await.result(queue.close(), 1.minute)
log.info("[queue-stop] closed")
}
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment