Skip to content

Instantly share code, notes, and snippets.

@LukasGasior1
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LukasGasior1/8bcf66e19ac388ae7104 to your computer and use it in GitHub Desktop.
Save LukasGasior1/8bcf66e19ac388ae7104 to your computer and use it in GitHub Desktop.
implicit val connection = Connection()
val queue = Queue(queueName, durable = false, autoDelete = true)
val bindArgs = Map("x-match" -> "all", "type" -> "DiceRolled")
val resultFuture = for {
_ <- connection.queueDeclare(queue)
_ <- connection.queueBind(queueName, exchangeName, "", bindArgs)
} yield ()
resultFuture onComplete {
case Success(_) =>
Source(connection.consume(queueName))
.map(_.message)
.to(Sink(SubscriberActor.props(statsActor)))
.run()(ActorFlowMaterializer())
case Failure(ex) =>
log.error("Cannot setup queue", ex)
sys.exit(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment