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._ | |
object MessageDiscarder { | |
case object WorkerAvailable | |
} | |
class MessageDiscarder extends Actor { | |
import MessageDiscarder._ | |
var queued: Option[(Any, ActorRef)] = None |
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 MasterProxy extends Actor { | |
// subscribe to LeaderChanged, re-subscribe when restart | |
override def preStart(): Unit = | |
Cluster(context.system).subscribe(self, classOf[LeaderChanged]) | |
override def postStop(): Unit = | |
Cluster(context.system).unsubscribe(self) | |
var leaderAddress: Option[Address] = None | |
def receive = { |
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
system.actorOf(Props(new ClusterSingletonManager( | |
singletonProps = handOverData => Props[Master]), | |
singletonName = "master", | |
terminationMessage = PoisonPill)), | |
name = "singleton") |
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
Cluster(system) registerOnMemberUp { | |
system.actorOf(Props(new FactorialFrontend(upToN, repeat = true)), | |
name = "factorialFrontend") | |
} |
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
akka.cluster.min-nr-of-members = 3 |
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
akka.actor.deployment { | |
/factorialFrontend/factorialBackendRouter = { | |
router = adaptive | |
# metrics-selector = heap | |
# metrics-selector = load | |
# metrics-selector = cpu | |
metrics-selector = mix | |
nr-of-instances = 100 | |
cluster { | |
enabled = on |
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
val backend = context.actorOf(Props[FactorialBackend]. | |
withRouter(FromConfig), name = "factorialBackendRouter") |
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-2013 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package akka.contrib.pattern | |
import scala.concurrent.duration._ | |
import akka.actor.Actor | |
import akka.actor.Actor.Receive | |
import akka.actor.ActorLogging |
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.{ Actor, ActorRef, Props, ActorSystem } | |
import akka.camel.{ CamelExtension, CamelMessage, Consumer, Producer } | |
import org.apache.activemq.camel.component.ActiveMQComponent | |
object CamelDemo extends App { | |
val system = ActorSystem("CamelDemo") | |
CamelExtension(system).context.addComponent("activemq", | |
ActiveMQComponent.activeMQComponent( | |
"vm://localhost?broker.persistent=false")) |
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 example | |
import java.util.concurrent.ConcurrentHashMap | |
import java.util.concurrent.ConcurrentLinkedQueue | |
import com.typesafe.config.Config | |
import com.typesafe.config.ConfigFactory | |
import akka.actor.Actor | |
import akka.actor.ActorContext | |
import akka.actor.ActorRef | |
import akka.actor.ActorSystem |