Skip to content

Instantly share code, notes, and snippets.

@adamw
Created June 11, 2018 18:35
Show Gist options
  • Save adamw/9363d6e5436b16f1c40c436de9bd4aec to your computer and use it in GitHub Desktop.
Save adamw/9363d6e5436b16f1c40c436de9bd4aec to your computer and use it in GitHub Desktop.
def consumeForever(inbox: MVar[BroadcastMessage]): Task[Unit] =
consume(connector, inbox).attempt
.map {
case Left(e) =>
logger.info("[broadcast] exception in queue consumer, restarting", e)
case Right(()) =>
logger.info("[broadcast] queue consumer completed, restarting")
}
.restartUntil(_ => false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment