diff --git a/Dockerfile b/Dockerfile index 62f9a2624c15b95cc1bd6a3c01c611eac279e15e..1ddc78d9a19badff6f0c0081dc2794f87b04b77f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/src/main/java/eu/hbp/mip/akka/WokenClientController.java b/src/main/java/eu/hbp/mip/akka/WokenClientController.java index f66b558ab0132159995ab0d518f6ba210bb59ee3..5931c13eb1aa64afdb0b573fb9844b06ad84ead5 100644 --- a/src/main/java/eu/hbp/mip/akka/WokenClientController.java +++ b/src/main/java/eu/hbp/mip/akka/WokenClientController.java @@ -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() { diff --git a/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java b/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java index 9cda0c97ec2464fb658da9fcb4b3aa07e49321ca..cfcfefe7dbb2bc637e4090a42c037ee1e3563b63 100644 --- a/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java +++ b/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java @@ -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; } diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index 9ba1bc59e8f248a6ab3a7e8bee44747db10976d3..ef6b8939114b7d878ca4b8690d1e91ed45d91c25 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -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"]