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