Merging dev to main #107

Merged
Maece97 merged 52 commits from dev into main 2021-12-23 16:12:19 +00:00
4 changed files with 62 additions and 17 deletions
Showing only changes of commit 0022ebaf88 - Show all commits

View File

@ -91,6 +91,7 @@ services:
auction.house.uri: http://tapas-auction-house:8086
executor.robot.uri: http://executor-robot:8084
executor.computation.uri: http://executor-computation:8085
executor.humidity.uri: http://executor-humidity:8087
mqtt.broker.uri: tcp://broker.hivemq.com:1883
spring.data.mongodb.uri: mongodb://root:password@tapas-db:27017
labels:
@ -164,3 +165,24 @@ services:
- "traefik.http.routers.executor-robot.tls=true"
- "traefik.http.routers.executor-robot.entryPoints=web,websecure"
- "traefik.http.routers.executor-robot.tls.certresolver=le"
executor-humidity:
image: openjdk
command: "java -jar /data/executor-humidity-0.0.1-SNAPSHOT.jar"
restart: unless-stopped
depends_on:
- executor-pool
- roster
- tapas-db
volumes:
- ./:/data/
environment:
EXECUTOR_POOL_URI: http://executor-pool:8083
ROSTER_URI: http://roster:8082
labels:
- "traefik.enable=true"
- "traefik.http.routers.executor-computation.rule=Host(`executor-humidity.${PUB_IP}.nip.io`)"
- "traefik.http.routers.executor-computation.service=executor-computation"
- "traefik.http.services.executor-computation.loadbalancer.server.port=8087"
- "traefik.http.routers.executor-computation.tls=true"
- "traefik.http.routers.executor-computation.entryPoints=web,websecure"
- "traefik.http.routers.executor-computation.tls.certresolver=le"

View File

@ -55,6 +55,10 @@ jobs:
run: mvn -f executor-robot/pom.xml --batch-mode --update-snapshots verify
- run: cp ./executor-robot/target/executor-robot-0.0.1-SNAPSHOT.jar ./target
- name: Build executor-humidity service
run: mvn -f executor-humidity/pom.xml --batch-mode --update-snapshots verify
- run: cp ./executor-humidity/target/executor-humidity-0.0.1-SNAPSHOT.jar ./target
- name: Build tapas-task service
run: mvn -f tapas-tasks/pom.xml --batch-mode --update-snapshots verify
- run: cp ./tapas-tasks/target/tapas-tasks-0.0.1-SNAPSHOT.jar ./target

View File

@ -29,7 +29,6 @@ public class Executor extends ExecutorBase {
protected
String execution(String inputData) {
executorLogger.info("TEST");
executorLogger.info("Executor | Starting execution with inputData: " + inputData);
ScriptEngineManager mgr = new ScriptEngineManager();
@ -45,10 +44,11 @@ public class Executor extends ExecutorBase {
}
try {
TimeUnit.SECONDS.sleep(5);
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
executorLogger.log(Level.SEVERE, e.getLocalizedMessage(), e);
Thread.currentThread().interrupt();
return result;
// executorLogger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// Thread.currentThread().interrupt();
}
executorLogger.info("Executor | Finish execution");

View File

@ -25,6 +25,9 @@ public class PublishNewTaskEventAdapter implements NewTaskEventPort {
@Value("${executor.computation.uri}")
private String server2;
@Value("${executor.humidity.uri}")
private String server3;
Logger logger = Logger.getLogger(PublishNewTaskEventAdapter.class.getName());
/**
@ -34,21 +37,21 @@ public class PublishNewTaskEventAdapter implements NewTaskEventPort {
@Override
public void publishNewTaskEvent(NewTaskEvent event) {
// HttpClient client = HttpClient.newHttpClient();
// HttpRequest request = HttpRequest.newBuilder()
// .uri(URI.create(server + "/newtask/" + event.taskType.getValue()))
// .GET()
// .build();
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(server + "/newtask/" + event.taskType.getValue()))
.GET()
.build();
// try {
// client.send(request, HttpResponse.BodyHandlers.ofString());
// } catch (InterruptedException e) {
// logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// Thread.currentThread().interrupt();
// } catch (IOException e) {
// logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// }
try {
client.send(request, HttpResponse.BodyHandlers.ofString());
} catch (InterruptedException e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
Thread.currentThread().interrupt();
} catch (IOException e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
HttpClient client2 = HttpClient.newHttpClient();
HttpRequest request2 = HttpRequest.newBuilder()
@ -65,6 +68,22 @@ public class PublishNewTaskEventAdapter implements NewTaskEventPort {
} catch (IOException e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
HttpClient client3 = HttpClient.newHttpClient();
HttpRequest request3 = HttpRequest.newBuilder()
.uri(URI.create(server3 + "/newtask/" + event.taskType.getValue()))
.GET()
.build();
try {
client3.send(request3, HttpResponse.BodyHandlers.ofString());
} catch (InterruptedException e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
Thread.currentThread().interrupt();
} catch (IOException e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
}