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

Use Artery TCP for Akka remoting

parent 0ba1faf4
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,9 @@ COPY docker/README.md docker/run.sh /
COPY --from=java-build-env /project/target/portal-backend.jar /usr/share/jars/
EXPOSE 8080
# 8080: Web service API, health checks on http://host:8087/health
# 4089: Akka cluster
EXPOSE 4089 8080
ENTRYPOINT ["/run.sh"]
......
......@@ -51,7 +51,7 @@ public abstract class WokenClientController {
protected <A, B> B askWoken(A message, int waitInSeconds) throws Exception {
LOGGER.info("Akka is trying to reach remote " + wokenPath);
DistributedPubSubMediator.Send queryMessage = new DistributedPubSubMediator.Send(wokenPath, message, true);
DistributedPubSubMediator.Send queryMessage = new DistributedPubSubMediator.Send(wokenPath, message, false);
Timeout timeout = new Timeout(Duration.create(waitInSeconds, "seconds"));
Future<Object> future = Patterns.ask(wokenMediator, queryMessage, timeout);
......@@ -81,12 +81,12 @@ public abstract class WokenClientController {
}
}
protected <A extends Query> Future<Object> sendWokenQuery(A query, int timeout) {
protected <A extends Query> Future<Object> sendWokenQuery(A query, int waitInSeconds) {
LOGGER.info("Akka is trying to reach remote " + wokenPath);
DistributedPubSubMediator.Send queryMessage = new DistributedPubSubMediator.Send(wokenPath, query, true);
DistributedPubSubMediator.Send queryMessage = new DistributedPubSubMediator.Send(wokenPath, query, false);
return Patterns.ask(wokenMediator, queryMessage, timeout);
return Patterns.ask(wokenMediator, queryMessage, waitInSeconds);
}
protected ExecutionContext getExecutor() {
......
......@@ -35,7 +35,7 @@ class AkkaConfiguration {
@Bean
public ActorSystem actorSystem() {
Config config = ConfigFactory.load("application.conf");
ActorSystem system = ActorSystem.create("PortalBackend", config);
ActorSystem system = ActorSystem.create("woken", config);
SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext);
return system;
}
......
......@@ -14,6 +14,8 @@ akka {
actor {
provider = "cluster"
allow-java-serialization = off
}
remote {
......@@ -27,23 +29,23 @@ akka {
acceptable-heartbeat-pause = 20 s
}
netty.tcp {
message-frame-size = 10000000b
send-buffer-size = 10000000b
receive-buffer-size = 10000000b
maximum-frame-size = 10000000b
artery {
enabled = on
transport = tcp
canonical.hostname = ${clustering.ip} # external (logical) hostname
canonical.port = ${clustering.port} # external (logical) port
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
bind-hostname = 0.0.0.0 # internal (bind) hostname
bind-port = ${clustering.port} # internal (bind) port
}
}
cluster {
seed-nodes = [
"akka.tcp://"${clustering.cluster.name}"@"${clustering.seed-ip}":"${clustering.seed-port}
"akka://"${clustering.cluster.name}"@"${clustering.seed-ip}":"${clustering.seed-port}
]
roles = ["portal"]
......
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