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 { | |
log-config-on-start = on | |
actor { | |
provider = "akka.cluster.ClusterActorRefProvider" | |
} | |
remote { | |
log-remote-lifecycle-events = off | |
netty.tcp { |
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 some5: Option[Int] = Some(5) | |
val missingInt: Option[Int] = None | |
val i: Int = 42 // Good | |
val i: Int = "Hello" // Compiler error | |
String st = "Hello" // Compiles | |
String st = null // Danger! Also compiles! | |
def findUserById(id: Int): Option[User] = { |
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 MyCounter extends Actor { | |
var count = 0 | |
def receive = { | |
case Add => count + 1 | |
case GetCount = sender tell count | |
} | |
} |
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
object UserPipeline { | |
case class Listen(ref: ActorRef) | |
case class Start(user: User) | |
case class Success(user: User) | |
} | |
class UserPipeline( | |
val source: ActorRef // This is an actor that produces a stream of users to be processed |
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
/** Reads queue of new users to index */ | |
class NewUserQueue extends Actor with ActorLogging { ... } | |
// Define our messages for the NewUserQueue | |
object NewUserQueue { | |
case class Listen(ref: ActorRef) | |
case class StopListen(ref: ActorRef) | |
case class NewUsers(users: Seq[User]) | |
} |
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
case class User(id: Long, name: String) | |
class Work { /* ... */ } | |
class Result { /* --- */ } | |
case class WorkToBeDone(user: User, work: Work) | |
case class WorkIsDone(user: User, result: Result) | |
class Worker extends Actor { /* ... */ } | |
class BadWorkerCoordinator extends Actor { |
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 { | |
/analytics/leader { | |
router = round-robin | |
nr-of-instances = 100 | |
cluster { | |
enabled = on | |
max-nr-of-instances-per-node = 3 | |
allow-local-routees = off | |
use-role = analytics | |
} |
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 AnalyticsLeader(supervisor: ActorRef) extends Leader[ProcessUser, AnalyticsNode, AnalyticsMessage](supervisor) |
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
#!/usr/bin/env ruby | |
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/ | |
puts "\e[31mPlease focus and remove your :focus tags before committing :)" | |
exit 1 | |
end |
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
core@ip-10-0-1-235 ~ $ cat /run/systemd/system/etcd.service.d/20-cloudinit.conf | |
[Service] | |
Environment="ETCD_ADDR=10.0.1.235:4001" | |
Environment="ETCD_CLUSTER_ACTIVE_SIZE=3" | |
Environment="ETCD_DISCOVERY=http://10.0.0.66:4001/v2/keys/_etcd/registry/cluster-dev-f9ekeksid832ik4k" | |
Environment="ETCD_NAME=10-0-1-235" | |
Environment="ETCD_PEER_ADDR=10.0.1.235:7001" | |
Environment="ETCD_TRACE=*" | |
Environment="ETCD_VERY_VERY_VERBOSE=true" |