Skip to content

Instantly share code, notes, and snippets.

@adamw
Created June 10, 2018 13:42
Show Gist options
  • Save adamw/86bf777ad1341ef03deb89ca6815cbe9 to your computer and use it in GitHub Desktop.
Save adamw/86bf777ad1341ef03deb89ca6815cbe9 to your computer and use it in GitHub Desktop.
class BroadcastActor(connector: QueueConnector[Future])
extends Actor with ActorLogging {
private var consumers: Set[ActorRef] = Set()
override def receive: Receive = {
case Subscribe(actor) => consumers += actor
case Received(msg) =>
consumers.foreach(_ ! msg)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment