This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.stream.scaladsl.Flow | |
import akka.stream.scaladsl.Tcp | |
import akka.util.ByteString | |
object TcpServerOneResponseThenComplete2 { | |
def main(args: Array[String]): Unit = { | |
implicit val system = ActorSystem() | |
import akka.stream.scaladsl.Framing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.stream.scaladsl.Flow | |
import akka.stream.scaladsl.Tcp | |
import akka.util.ByteString | |
object TcpServerOneResponseThenComplete { | |
def main(args: Array[String]): Unit = { | |
implicit val system = ActorSystem() | |
import akka.stream.scaladsl.Framing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyActor extends AbstractActor { | |
public Receive createReceive() { | |
return receiveBuilder() | |
.match(Request.class, this::onRequest) | |
.build(); | |
} | |
private void onRequest(Request request) { | |
ActorRef child = createChildForRequest(request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.cluster.Cluster | |
import com.typesafe.config.ConfigFactory | |
object ProgrammaticJoin extends App { | |
val commonConfig = ConfigFactory.parseString( | |
""" | |
akka { | |
actor.provider = cluster | |
remote.artery.enabled = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.NotUsed | |
import akka.actor.ActorSystem | |
import akka.stream.scaladsl.{GraphDSL, Partition, Sink, Source} | |
import akka.stream.{ActorMaterializer, SinkShape} | |
import scala.reflect.ClassTag | |
object PartitionOnType extends App { | |
implicit val system = ActorSystem() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.NotUsed; | |
import akka.actor.ActorSystem; | |
import akka.http.javadsl.ConnectHttp; | |
import akka.http.javadsl.Http; | |
import akka.http.javadsl.model.HttpRequest; | |
import akka.http.javadsl.model.HttpResponse; | |
import akka.http.javadsl.model.ws.Message; | |
import akka.http.javadsl.model.ws.TextMessage; | |
import akka.http.javadsl.server.Route; | |
import akka.stream.ActorMaterializer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model.ContentTypes | |
import akka.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller} | |
import akka.stream.ActorMaterializer | |
object MultipleUnmarshallers extends App { | |
implicit val system = ActorSystem() | |
implicit val materializer = ActorMaterializer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com> | |
*/ | |
package http | |
import java.util.concurrent.atomic.AtomicInteger | |
import akka.actor.{Actor, ActorRef, ActorSystem, Props} | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model.{HttpResponse, StatusCodes, Uri} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.typed.Behavior | |
import akka.typed.scaladsl.Actor._ | |
sealed trait LifecycleCommand | |
object Stop extends LifecycleCommand | |
val lifecycleBehavior: Behavior[LifecycleCommand] = | |
immutable[LifecycleCommand]((ctx, msg) => | |
msg match { | |
case Stop => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package basics | |
import akka.actor.{ActorSystem, ExtendedActorSystem} | |
import akka.serialization.{JavaSerializer, SerializationExtension} | |
import com.typesafe.config.ConfigFactory | |
trait MyPayload | |
trait OtherPayload | |
trait PersistentExecutorProtocol extends Serializable { |
NewerOlder