diff options
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/service')
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/service/MsgService.java | 11 | ||||
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/service/MzsService.java | 2 |
2 files changed, 8 insertions, 5 deletions
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<String> backend; + private final TaskExecutor taskExecutor; @Autowired - public MsgService(DeliveryRepository repository, Consumer<String> msgResponseBackend) { + public MsgService(DeliveryRepository repository, Consumer<String> 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); } |