assignment service + executor-base improvements #23

Merged
Maece97 merged 8 commits from assignment into dev 2021-10-17 11:57:43 +00:00
4 changed files with 12 additions and 4 deletions
Showing only changes of commit b072cfc7ce - Show all commits

View File

@ -5,6 +5,8 @@ import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@ -18,6 +20,8 @@ public class PublishNewTaskEventAdapter implements NewTaskEventPort {
String server = "http://127.0.0.1:8085";
Logger logger = Logger.getLogger(PublishNewTaskEventAdapter.class.getName());
@Override
public void publishNewTaskEvent(NewTaskEvent event) {
@ -31,7 +35,7 @@ public class PublishNewTaskEventAdapter implements NewTaskEventPort {
try {
client.send(request, HttpResponse.BodyHandlers.ofString());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// Restore interrupted state...
Thread.currentThread().interrupt();
}

View File

@ -5,6 +5,8 @@ import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONObject;
import org.springframework.context.annotation.Primary;
@ -19,6 +21,8 @@ public class PublishTaskCompletedEventAdapter implements TaskCompletedEventPort
String server = "http://127.0.0.1:8081";
Logger logger = Logger.getLogger(PublishTaskCompletedEventAdapter.class.getName());
@Override
public void publishTaskCompleted(TaskCompletedEvent event) {
@ -39,7 +43,7 @@ public class PublishTaskCompletedEventAdapter implements TaskCompletedEventPort
try {
client.send(request, HttpResponse.BodyHandlers.ofString());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// Restore interrupted state...
Thread.currentThread().interrupt();
}

View File

@ -30,6 +30,6 @@ public class Task {
this.taskType = taskType;
}
public Task() {};
public Task() {}
}

View File

@ -1,7 +1,7 @@
package ch.unisg.assignment.assignment.domain.event;
public class TaskAssignedEvent {
public String taskID;
public final String taskID;
public TaskAssignedEvent(String taskID) {
this.taskID = taskID;