Skip to content

Instantly share code, notes, and snippets.

@patriknw
patriknw / Squarer.java
Created Dec 14, 2019
Methods delegation to actor
View Squarer.java
package squerer;
import akka.actor.typed.ActorRef;
import akka.actor.typed.Behavior;
import akka.actor.typed.Scheduler;
import akka.actor.typed.javadsl.AbstractBehavior;
import akka.actor.typed.javadsl.ActorContext;
import akka.actor.typed.javadsl.AskPattern;
import akka.actor.typed.javadsl.Behaviors;
import akka.actor.typed.javadsl.Receive;
@patriknw
patriknw / AtLeastOnceExample.scala
Created Sep 11, 2019
AtLeastOnceDelivery in Akka Typed
View AtLeastOnceExample.scala
package docs.akka.persistence.typed
import scala.concurrent.duration.FiniteDuration
import akka.actor.typed.ActorRef
import akka.actor.typed.Behavior
import akka.actor.typed.scaladsl.Behaviors
import akka.actor.typed.scaladsl.LoggerOps
import akka.persistence.typed.PersistenceId
import akka.persistence.typed.RecoveryCompleted
View SyncTestingFSMExampleSpec.scala
import akka.actor.testkit.typed.scaladsl.BehaviorTestKit
import akka.actor.typed.Behavior
import akka.actor.typed.scaladsl.AbstractBehavior
import org.scalatest.Matchers
import org.scalatest.WordSpec
object SyncTestingFSMExampleSpec {
sealed trait Command
final case class Type(c: Char) extends Command
@patriknw
patriknw / LinearStageLogic.scala
Created Jun 13, 2018
Prototype LinearStage
View LinearStageLogic.scala
/**
* Copyright (C) 2018 Lightbend Inc. <http://www.lightbend.com>
*/
package akka.stream.stage
import scala.collection.immutable
import scala.concurrent.duration.FiniteDuration
import akka.NotUsed
import akka.annotation.InternalApi
@patriknw
patriknw / AccountExample1.scala
Last active May 23, 2018
Alternative implementation of PR 25051
View AccountExample1.scala
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
@patriknw
patriknw / FlowControlSample.scala
Last active May 10, 2018
Illustrates Actor message flow control with "work pulling pattern". This code is licensed under the Apache 2 license.
View FlowControlSample.scala
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
/**
View debug-aeron-counters.md

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 / akka-getting-started-guide.txt
Created Aug 18, 2017
Getting Started Guide in plain text format
View akka-getting-started-guide.txt
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
@patriknw
patriknw / AlpakkaPR.scala
Created Apr 18, 2017
Alpakka PR assignments
View AlpakkaPR.scala
val reviewers = Vector(
"2m",
"jrudolph",
"johanandren",
"ktoso",
"patriknw",
"raboof"
)
def assign(pr: Int): String =
View gist:5f9eebb86410d281741b3f4734b96d34
---
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 {