From 8799a27e8d73c5e079d549f6d76abf861d75ee9e Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Mon, 2 Dec 2019 14:26:42 +0100 Subject: Finalize "Removal of JAXB Class Not Found Fix" - Problem: I fixed CompletableFuture.*async within the DeliveryRequest flow, but forgot to do the same for the DeliveryRequestStatus / DeliveryNotification flow. - Solution: Ensure that all CompletableFuture.*async() invocations have Spring's task executor attached. --- src/main/java/at/gv/egiz/moazs/service/MsgService.java | 11 +++++++---- src/main/java/at/gv/egiz/moazs/service/MzsService.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/gv/egiz/moazs/service') diff --git a/src/main/java/at/gv/egiz/moazs/service/MsgService.java b/src/main/java/at/gv/egiz/moazs/service/MsgService.java index 8c71166..6b260e7 100644 --- a/src/main/java/at/gv/egiz/moazs/service/MsgService.java +++ b/src/main/java/at/gv/egiz/moazs/service/MsgService.java @@ -28,6 +28,7 @@ import at.gv.egiz.moazs.scheme.RequestStatusResponse; import at.gv.zustellung.msg.xsd.*; import org.apache.cxf.annotations.SchemaValidation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Service; import java.util.function.Consumer; @@ -43,16 +44,18 @@ import static java.util.concurrent.CompletableFuture.runAsync; */ @Service @SchemaValidation(type = SchemaValidation.SchemaValidationType.BOTH) -@org.apache.cxf.feature.Features (features = "org.apache.cxf.ext.logging.LoggingFeature") + @org.apache.cxf.feature.Features (features = "org.apache.cxf.ext.logging.LoggingFeature") public class MsgService implements Zuse2AppPort { private final DeliveryRepository repository; private final Consumer backend; + private final TaskExecutor taskExecutor; @Autowired - public MsgService(DeliveryRepository repository, Consumer msgResponseBackend) { + public MsgService(DeliveryRepository repository, Consumer msgResponseBackend, TaskExecutor taskExecutor) { this.repository = repository; this.backend = msgResponseBackend; + this.taskExecutor = taskExecutor; } @Override @@ -85,8 +88,8 @@ public class MsgService implements Zuse2AppPort { } private void sendToWork(MsgResponse response) { - runAsync(() -> repository.store(response)) - .thenRunAsync(() -> backend.accept(response.getResponseID())); + runAsync(() -> repository.store(response), taskExecutor) + .thenRunAsync(() -> backend.accept(response.getResponseID()), taskExecutor); } private DeliveryNotificationACKType notificationAck(String appDeliveryID, String zsDeliveryID) { diff --git a/src/main/java/at/gv/egiz/moazs/service/MzsService.java b/src/main/java/at/gv/egiz/moazs/service/MzsService.java index 55f0554..ee14af8 100644 --- a/src/main/java/at/gv/egiz/moazs/service/MzsService.java +++ b/src/main/java/at/gv/egiz/moazs/service/MzsService.java @@ -142,7 +142,7 @@ public class MzsService implements App2MzsPortType { log.info(SERVICE_TIME_OUT_REACHED_MSG, appDeliveryID); var sinkParams = request.getConfig().getMsgResponseSinks(); - requestProcessed.thenAcceptAsync(response -> hub.applySinks(response, sinkParams)); + requestProcessed.thenAcceptAsync(response -> hub.applySinks(response, sinkParams), taskExecutor); return generatePartialSuccessResponse(appDeliveryID); } -- cgit v1.2.3