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

Cleanup configuration of Akka

parent a62ccc2b
No related branches found
No related tags found
No related merge requests found
......@@ -84,9 +84,3 @@ endpoints:
services:
exareme:
miningExaremeUrl: {{ default .Env.EXAREME_URL "http://localhost:9090" }}/mining/query
akka:
woken:
host: {{ default .Env.WOKEN_PORT_8088_TCP_ADDR "woken" }}
port: {{ default .Env.WOKEN_PORT_8088_TCP_PORT "8088" }}
path: {{ default .Env.WOKEN_AKKA_PATH "/user/entrypoint" }}
package eu.hbp.mip.akka;
import akka.actor.ActorRef;
import akka.cluster.Cluster;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Health;
......@@ -11,9 +10,6 @@ import org.springframework.stereotype.Component;
@Component
public class AkkaClusterHealthCheck implements HealthIndicator {
@Autowired
private ActorRef wokenMediator;
@Autowired
private Cluster wokenCluster;
......
......@@ -30,9 +30,6 @@ public abstract class WokenClientController {
@Autowired
private ActorSystem actorSystem;
@Autowired
private String wokenReceptionistPath;
@Value("#{'${akka.woken.path:/user/entrypoint}'}")
private String wokenPath;
......
......@@ -10,12 +10,13 @@ import com.typesafe.config.ConfigFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import java.util.List;
import static eu.hbp.mip.akka.SpringExtension.SPRING_EXTENSION_PROVIDER;
/**
......@@ -31,18 +32,10 @@ class AkkaConfiguration {
@Autowired
private ApplicationContext applicationContext;
@Value("#{'${akka.woken.host:woken}'}")
private String wokenHost;
@Value("#{'${akka.woken.port:8088}'}")
private String wokenPort;
@Value("#{'${akka.woken.path:/user/entrypoint}'}")
private String wokenPath;
private final Config config = ConfigFactory.load("application.conf");
@Bean
public ExtendedActorSystem actorSystem() {
Config config = ConfigFactory.load("application.conf");
ExtendedActorSystem system = (ExtendedActorSystem) ActorSystem.create("woken", config);
SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext);
return system;
......@@ -54,13 +47,13 @@ class AkkaConfiguration {
}
@Bean
public String wokenReceptionistPath() {
return "akka.tcp://woken@" + wokenHost + ":" + wokenPort + "/system/receptionist";
public List<String> wokenPath() {
return config.getStringList("akka.cluster.seed-nodes");
}
@Bean
public ActorRef wokenMediator() {
LOGGER.info("Start Woken client " + wokenReceptionistPath());
LOGGER.info("Connect to Woken cluster at " + String.join(",", wokenPath()));
return DistributedPubSub.get(actorSystem()).mediator();
}
......
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