Skip to content
Snippets Groups Projects
Commit 84ffd12e authored by Ludovic Claude's avatar Ludovic Claude
Browse files

Easy switch between Netty and Artery remoting

parent f150e687
No related branches found
No related tags found
No related merge requests found
...@@ -31,8 +31,22 @@ class AkkaConfiguration { ...@@ -31,8 +31,22 @@ class AkkaConfiguration {
@Autowired @Autowired
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
private final Config config = ConfigFactory.load("application.conf"); private final Config config;
{
Config remotingConfig = ConfigFactory.parseResourcesAnySyntax("akka-remoting.conf").resolve();
String remotingImpl = remotingConfig.getString("remoting.implementation");
config = ConfigFactory
.parseString("akka {\n" +
" actor.provider = cluster\n" +
" extensions += \"akka.cluster.pubsub.DistributedPubSub\"\n" +
"}")
.withFallback(ConfigFactory.parseResourcesAnySyntax("akka.conf"))
.withFallback(ConfigFactory.parseResourcesAnySyntax("akka-" + remotingImpl + "-remoting.conf"))
.withFallback(ConfigFactory.parseResourcesAnySyntax("kamon.conf"))
.withFallback(ConfigFactory.load())
.resolve();
}
@Bean @Bean
public ExtendedActorSystem actorSystem() { public ExtendedActorSystem actorSystem() {
......
akka {
remote {
netty.tcp {
enabled = off
}
artery {
enabled = on
transport = tcp
canonical.hostname = ${clustering.ip} # external (logical) hostname
canonical.port = ${clustering.port} # external (logical) port
bind.hostname = 0.0.0.0 # internal (bind) hostname
bind.port = ${clustering.port} # internal (bind) port
}
}
}
remoting {
protocol = "akka"
}
akka {
remote {
netty.tcp {
hostname = ${clustering.ip} # external (logical) hostname
port = ${clustering.port} # external (logical) port
bind-hostname = 0.0.0.0 # internal (bind) hostname
bind-port = ${clustering.port} # internal (bind) port
}
artery {
enabled = off
}
}
}
remoting {
protocol = "akka.tcp"
}
remoting {
implementation = "netty"
# Alternative option is 'artery'
implementation = ${?AKKA_REMOTING}
}
# Merged with defaults in woken-messages/reference.conf
akka {
loglevel = "WARNING"
loglevel = ${?LOG_LEVEL}
stdout-loglevel = "WARNING"
stdout-loglevel = ${?LOG_LEVEL}
loggers = ["akka.event.slf4j.Slf4jLogger"]
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
log-config-on-start = off
log-config-on-start = ${?LOG_CONFIG}
log-dead-letters = 10
log-dead-letters-during-shutdown = off
actor {
# provider = "cluster"
allow-java-serialization = off
enable-additional-serialization-bindings = true
}
remote {
log-sent-messages = off
log-received-messages = off
log-remote-lifecycle-events = off
watch-failure-detector {
acceptable-heartbeat-pause = 20 s
}
}
cluster {
seed-nodes = [
${remoting.protocol}"://"${clustering.cluster.name}"@"${clustering.seed-ip}":"${clustering.seed-port}
]
roles = ["portal"]
}
http {
server {
idle-timeout = 300s
request-timeout = 180s
ssl-encryption = off
ssl-tracing = on
}
client {
idle-timeout = 300s
request-timeout = 20 s
}
}
}
akka { # No specific configuration for Portal backend
loglevel = "WARNING" # All configuration is related to Akka
loglevel = ${?LOG_LEVEL}
stdout-loglevel = "WARNING"
stdout-loglevel = ${?LOG_LEVEL}
loggers = ["akka.event.slf4j.Slf4jLogger"]
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
log-config-on-start = off
log-config-on-start = ${?LOG_CONFIG}
log-dead-letters = 10
log-dead-letters-during-shutdown = off
actor {
provider = "cluster"
allow-java-serialization = off
enable-additional-serialization-bindings = true
}
remote {
log-sent-messages = off
log-received-messages = off
log-remote-lifecycle-events = off
watch-failure-detector {
acceptable-heartbeat-pause = 20 s
}
artery {
enabled = on
transport = tcp
canonical.hostname = ${clustering.ip} # external (logical) hostname
canonical.port = ${clustering.port} # external (logical) port
bind.hostname = 0.0.0.0 # internal (bind) hostname
bind.port = ${clustering.port} # internal (bind) port
}
}
cluster {
seed-nodes = [
"akka://"${clustering.cluster.name}"@"${clustering.seed-ip}":"${clustering.seed-port}
]
roles = ["portal"]
}
extensions += "akka.cluster.pubsub.DistributedPubSub"
}
clustering {
ip = "127.0.0.1"
ip = ${?CLUSTER_IP}
port = 4489
port = ${?CLUSTER_PORT}
seed-ip = "woken"
seed-ip = ${?CLUSTER_IP}
seed-ip = ${?WOKEN_PORT_8088_TCP_ADDR}
seed-port = 8088
seed-port = ${?WOKEN_PORT_8088_TCP_PORT}
cluster.name = "woken"
cluster.name = ${?CLUSTER_NAME}
}
kamon {
enabled = no
enabled = ${?KAMON_ENABLED}
environment {
service = "woken"
}
zipkin = {
enabled = no
enabled = ${?ZIPKIN_ENABLED}
host = "zipkin"
host = ${?ZIPKIN_IP}
port = 9411
port = ${?ZIPKIN_PORT}
}
prometheus = {
enabled = no
enabled = ${?PROMETHEUS_ENABLED}
host = "prometheus"
host = ${?PROMETHEUS_IP}
port = 9090
port = ${?PROMETHEUS_PORT}
}
util.filters {
"akka.tracked-actor" {
includes = ["**"]
}
"akka.tracked-dispatcher" {
includes = ["**"]
}
"akka.traced-actor" {
includes = ["**"]
}
}
akka-http {
add-http-status-code-as-metric-tag = true
}
akka {
ask-pattern-timeout-warning = lightweight
}
trace {
join-remote-parents-with-same-span-id = yes
}
system-metrics {
host {
enabled = no
enabled = ${?SIGAR_SYSTEM_METRICS}
}
jvm {
enabled = no
enabled = ${?JVM_SYSTEM_METRICS}
}
}
}
app {
clusterSystemName = ${clustering.cluster.name}
}
# Merged with defaults in woken-messages/reference.conf
clustering {
ip = "127.0.0.1"
ip = ${?CLUSTER_IP}
port = 4489
port = ${?CLUSTER_PORT}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment