Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonas Bonér jboner

View GitHub Profile
@jboner
jboner / OrderManagement.scala
Created Nov 10, 2017
Demo of an Event-driven Architecture in Akka and Scala. Show-casing Events-first DDD, Event Sourced Aggregates, Process Manager, etc.
View OrderManagement.scala
package sample.eventdriven.scala
import akka.actor.{Actor, ActorRef, ActorSystem, Inbox, Props}
import akka.persistence.PersistentActor
import scala.concurrent.ExecutionContext.Implicits._
import scala.concurrent.duration._
// ===============================================================
// Demo of an Event-driven Architecture in Akka and Scala.
@jboner
jboner / OrderManagement.java
Created Nov 10, 2017
Demo of an Event-driven Architecture in Akka and Java. Show-casing Events-first DDD, Event Sourced Aggregates, Process Manager, etc.
View OrderManagement.java
package sample.eventdriven.java;
import akka.actor.*;
import akka.persistence.AbstractPersistentActor;
import scala.concurrent.duration.Duration;
import java.io.Serializable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@jboner
jboner / PersistentVendingMachine.scala
Last active Mar 7, 2019
Persistent Vending Machine Akka Supervision Demo
View PersistentVendingMachine.scala
import akka.actor.SupervisorStrategy._
import akka.actor._
import akka.persistence.PersistentActor
import scala.concurrent.duration._
// Coffee types
trait CoffeeType
case object BlackCoffee extends CoffeeType
case object Latte extends CoffeeType
case object Espresso extends CoffeeType
@jboner
jboner / VendingMachine.scala
Last active Nov 13, 2015
Vending Machine Akka Supervision Demo
View VendingMachine.scala
import akka.actor._
import akka.actor.SupervisorStrategy._
import scala.concurrent.duration._
// Coffee types
trait CoffeeType
case object BlackCoffee extends CoffeeType
case object Latte extends CoffeeType
case object Espresso extends CoffeeType
@jboner
jboner / keybase.md
Last active Jan 6, 2016
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am jboner on github.
  • I am jonas (https://keybase.io/jonas) on keybase.
  • I have a public key ASB-dCL3b2wk3TzgiVeoHmmp_s-ZM004MVmlztARjGu-pAo

To claim this, I am signing this object:

@jboner
jboner / GameOfPingPong.scala
Last active Mar 27, 2019
A game of ping pong using Akka Actors. For a version that is persisted using Event-Sourcing see this gist: https://gist.github.com/jboner/9990435
View GameOfPingPong.scala
package demo
import akka.actor.{Actor, Props, ActorSystem}
object PingPong extends App {
case object Ball
class Ping extends Actor {
var counter = 0
@jboner
jboner / PersistedGameOfPingPong.scala
Last active Mar 27, 2019
A game of ping pong using two Akka Actors, persisted using Event Sourcing through Akka Persistence
View PersistedGameOfPingPong.scala
package demo
import akka.actor.{Props, ActorSystem}
import akka.persistence.PersistentActor
object PingPong extends App {
case object Ball // The Command
case object BallReceived // The Domain Event, represents a Fact, something that have already happened
class Ping extends PersistentActor {
@jboner
jboner / how-akka-maps-to-eai-patterns.txt
Last active Mar 1, 2020
How Akka maps to EAI Patterns
View how-akka-maps-to-eai-patterns.txt
# How Akka maps to EAI Patterns
Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago.
-----------------------------------------------------------------------------------------------------------------
EAI PATTERN AKKA PATTERN REFERENCE
-----------------------------------------------------------------------------------------------------------------
Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html
Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html
Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html
You can’t perform that action at this time.