aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/backend
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-12-09 10:25:02 +0100
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-12-09 10:25:02 +0100
commit1d2aafe0cd6607a48d880c007881768079e49060 (patch)
tree4eaf58525e39986a6c9483e1751d54ebb941ec54 /src/main/java/at/gv/egiz/moazs/backend
parent5cb5e4803e315bb717c9db882f60c848da8e660c (diff)
downloadmoa-zs-1d2aafe0cd6607a48d880c007881768079e49060.tar.gz
moa-zs-1d2aafe0cd6607a48d880c007881768079e49060.tar.bz2
moa-zs-1d2aafe0cd6607a48d880c007881768079e49060.zip
Refactor & Fixes
- Handle InterruptedExceptions as discussed in https://stackoverflow.com/questions/3976344/handling-interruptedexception-in-java - Remove unused imports.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/backend')
-rw-r--r--src/main/java/at/gv/egiz/moazs/backend/MsgResponseBackend.java6
-rw-r--r--src/main/java/at/gv/egiz/moazs/backend/MsgResponseSinkHub.java4
2 files changed, 3 insertions, 7 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/backend/MsgResponseBackend.java b/src/main/java/at/gv/egiz/moazs/backend/MsgResponseBackend.java
index 45a4000..cc20cc9 100644
--- a/src/main/java/at/gv/egiz/moazs/backend/MsgResponseBackend.java
+++ b/src/main/java/at/gv/egiz/moazs/backend/MsgResponseBackend.java
@@ -58,7 +58,7 @@ public class MsgResponseBackend {
"with AppDeliveryID=%s is not valid.";
public static final String BINARY_RESPONSE_MISSING_ERROR_MSG = "Binary Response is not in repository.";
public static final String RESPONSE_MISSING_ERROR_MSG = "Response with ResponseID=%s is not in repository.";
- public static final String REQUEST_MISSING_ERROR_MSG = "Request with AppDeliveryID=%s is not in repository. " +
+ public static final String REQUEST_MISSING_ERROR_MSG = "Request with AppDeliveryID={} is not in repository. " +
"Falling Back to Default Configuration.";
private final DeliveryRepository repository;
@@ -96,7 +96,7 @@ public class MsgResponseBackend {
public CompletableFuture<Void> accept(String responseID) {
log.info("Backend accepts MsgResponse with responseID={}.", responseID);
return supplyAsync(() -> verifySignature(responseID), taskExecutor)
- .thenCompose(msgResponse -> applySinks(msgResponse));
+ .thenCompose(this::applySinks);
}
private MsgResponse verifySignature(String responseID) {
@@ -138,7 +138,7 @@ public class MsgResponseBackend {
private Supplier<DeliveryRequestType> supplyRequestWithDefaultConfig(String appDeliveryID) {
return () -> {
- log.warn(format(REQUEST_MISSING_ERROR_MSG, appDeliveryID));
+ log.warn(REQUEST_MISSING_ERROR_MSG, appDeliveryID);
var defaultConfig = deliveryRequestConfigs.get(DEFAULT_CONFIG_KEY);
validator.areSinksConfigured(defaultConfig.getMsgResponseSinks());
return deliveryRequestTypeBuilder()
diff --git a/src/main/java/at/gv/egiz/moazs/backend/MsgResponseSinkHub.java b/src/main/java/at/gv/egiz/moazs/backend/MsgResponseSinkHub.java
index 64b559f..9869e2e 100644
--- a/src/main/java/at/gv/egiz/moazs/backend/MsgResponseSinkHub.java
+++ b/src/main/java/at/gv/egiz/moazs/backend/MsgResponseSinkHub.java
@@ -22,21 +22,17 @@
package at.gv.egiz.moazs.backend;
import at.gv.egiz.moazs.scheme.MsgResponse;
-import at.gv.egiz.moazs.scheme.RequestStatusResponse;
import at.gv.zustellung.app2mzs.xsd.MsgResponseSinksType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionStage;
import static java.util.concurrent.CompletableFuture.allOf;
-import static java.util.concurrent.CompletableFuture.supplyAsync;
/**
* @author Christof Rabensteiner