Skip to content

Instantly share code, notes, and snippets.

@kachayev
Last active December 20, 2015 12:19
Show Gist options
  • Save kachayev/6130353 to your computer and use it in GitHub Desktop.
Save kachayev/6130353 to your computer and use it in GitHub Desktop.
Eventsourced and reliable channel in Scala
class Sender(receiverPath: String) extends Actor {
val id = 1
val ext = EventsourcingExtension(context.system)
val proxy = context.actorOf(
Props(new DestinationProxy(receiverPath)))
val channel = ext.channelOf(ReliableChannelProps(1, proxy)
.withRedeliveryMax(1000)
.withRedeliveryDelay(1 second)
.withConfirmationTimeout(2 seconds))
def receive = {
case msg: Message => {
sender ! s"accepted ${msg.event}"
channel forward msg
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment