Skip to content

Instantly share code, notes, and snippets.

/**
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.event.japi
/**
* Java API: See documentation for [[akka.event.EventBus]]
* E is the Event type
* S is the Subscriber type
* C is the Classifier type
@patriknw
patriknw / gist:3feec3899cd8c9870d7d
Created September 22, 2014 06:48
akka-data-replication performance v0.6 vs v0.5

Results of running PerformanceSpec for version 0.6 and 0.5 of akka-data-replication

== Version 0.6 ==

500 ORSet Update WriteOne took 43 ms, 11627 TPS
500 ORSet Update WriteOne took 9 ms, 55555 TPS
500 ORSet Update WriteOne took 8 ms, 62500 TPS
500 ORSet Update WriteOne took 8 ms, 62500 TPS
500 ORSet Update WriteOne took 5 ms, 100000 TPS

500 ORSet Update WriteOne took 6 ms, 83333 TPS

@patriknw
patriknw / gist:4bcec28b8d3e5c5e56cc
Created November 16, 2015 07:39
Cassandra materialized view
cqlsh:ks1> CREATE TABLE events (
... persistence_id text,
... partition_nr bigint,
... sequence_nr bigint,
... timestamp timeuuid,
... message text,
... tag text,
... used boolean static,
... PRIMARY KEY ((persistence_id, partition_nr), sequence_nr, timestamp)
... ) WITH CLUSTERING ORDER BY (sequence_nr ASC);
@patriknw
patriknw / MaxStage.scala
Last active July 8, 2016 14:31
Blog: GraphStage emit and friends
package blog
import akka.stream.Attributes
import akka.stream.FlowShape
import akka.stream.Inlet
import akka.stream.Outlet
import akka.stream.stage.GraphStage
import akka.stream.stage.GraphStageLogic
import akka.stream.stage.InHandler
import akka.stream.stage.OutHandler
---
core/src/main/scala/akka/kafka/javadsl/Producer.scala | 12 ++++++------
core/src/main/scala/akka/kafka/scaladsl/Producer.scala | 18 +++++++++---------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/core/src/main/scala/akka/kafka/javadsl/Producer.scala b/core/src/main/scala/akka/kafka/javadsl/Producer.scala
index 86005b7..6bae123 100644
--- a/core/src/main/scala/akka/kafka/javadsl/Producer.scala
+++ b/core/src/main/scala/akka/kafka/javadsl/Producer.scala
@@ -38,11 +38,11 @@ object Producer {
@patriknw
patriknw / AlpakkaPR.scala
Created April 18, 2017 15:21
Alpakka PR assignments
val reviewers = Vector(
"2m",
"jrudolph",
"johanandren",
"ktoso",
"patriknw",
"raboof"
)
def assign(pr: Int): String =
@patriknw
patriknw / akka-getting-started-guide.txt
Created August 18, 2017 14:34
Getting Started Guide in plain text format
Akka Documentation - Getting Started Guide
------------------------------------------
Version 2.5.4
Also in HTML format:
http://doc.akka.io/docs/akka/current/scala/guide/index.html
http://doc.akka.io/docs/akka/current/java/guide/index.html
© 2011-2017 Lightbend

Three nodes: gw-1001, gw-2001, gw-3001 At first everything is good, but after a while it Looks like some messages are not received. 1001 receives ok from 3001, but not from 2001 2001 receives ok from 3001, but not from 1001 3001 receives nothing from 1001 and 2001

Here are Aeron counters from the 3 nodes at 5 points in time. Note the NAKs.

  • gw-1001
@patriknw
patriknw / FlowControlSample.scala
Last active May 10, 2018 18:35
Illustrates Actor message flow control with "work pulling pattern". This code is licensed under the Apache 2 license.
package flowcontrol
import scala.concurrent.duration._
import akka.actor.typed.ActorRef
import akka.actor.typed.ActorSystem
import akka.actor.typed.Behavior
import akka.actor.typed.scaladsl.Behaviors
/**
@patriknw
patriknw / AccountExample1.scala
Last active May 23, 2018 09:51
Alternative implementation of PR 25051
object AccountExample1 {
sealed trait AccountCommand
case object CreateAccount extends AccountCommand
case class Deposit(amount: Double) extends AccountCommand
case class Withdraw(amount: Double) extends AccountCommand
case object CloseAccount extends AccountCommand
sealed trait AccountEvent
case object AccountCreated extends AccountEvent