GH-80 - Introduce ApplicationModuleIntegrationListener.

We now provide @ApplicationModuleIntegrationListener as shortcut for the combination of @Async @Transactional @TransactionalEventListener to provide a dedicated annotation for the recommended integration arrangement.
This commit is contained in:
Oliver Drotbohm
2022-11-24 21:24:27 +01:00
parent 486f7e0c86
commit 9463b598c3
5 changed files with 112 additions and 8 deletions

View File

@@ -19,9 +19,8 @@ import example.order.OrderCompleted;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.modulith.ApplicationModuleIntegrationListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.event.TransactionalEventListener;
/**
* A Spring {@link Service} exposed by the inventory module.
@@ -35,8 +34,7 @@ public class InventoryManagement {
private final InventoryInternal dependency;
@Async
@TransactionalEventListener
@ApplicationModuleIntegrationListener
void on(OrderCompleted event) throws InterruptedException {
var orderId = event.getOrderId();