diff --git a/mongodb-inbox-outbox/README.md b/mongodb-inbox-outbox/README.md index 7846013..f42b283 100644 --- a/mongodb-inbox-outbox/README.md +++ b/mongodb-inbox-outbox/README.md @@ -21,7 +21,7 @@ The last command will block the current terminal, so to continue you need to ope #### Initiate the test scenario: In a new Terminal enter the following command: ```bash -curl -L 'http://localhost:8080/shipping/register-order' \ +curl -L 'http://localhost:8080/shipping/register-order' \ -X POST \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ @@ -38,7 +38,7 @@ curl -L 'http://localhost:8080/shipping/register-order' \ #### Complete the test scenario: In the same Terminal enter the following command: ```bash -curl -L 'http://localhost:8080/shipping/ship-order' \ +curl -L 'http://localhost:8080/shipping/ship-order' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ diff --git a/pom.xml b/pom.xml index 17c2f36..5f17a0f 100644 --- a/pom.xml +++ b/pom.xml @@ -61,32 +61,32 @@ false - 0.40.19 + 0.40.20 3.2.12 - 6.1.15 - 2023.0.12 + 6.1.16 + 2023.0.14 4.2.12 3.2.12 3.4 - 42.7.4 + 42.7.5 2.0.16 4.2.2 - 3.26.3 + 3.27.3 4.11.5 - 2.24.2 + 2.24.3 2.5.1 2.9.0 2.3 1.12.13 1.2.12 - 4.1.115.Final - 5.11.3 + 4.1.117.Final + 5.11.4 1.20.4 3.47.0 2.17.3 - 5.14.2 - 1.5.12 + 5.15.2 + 1.5.16 1.12.0 1.27.1 2.10.0 @@ -101,22 +101,22 @@ 3.8.1 - 3.7.0 + 3.8.0 3.4.0 3.1.3 3.3.1 3.1.3 - 3.20.0 + 3.21.0 3.4.2 3.3.1 - 3.10.1 + 3.11.2 3.5.2 3.5.2 3.13.0 2.18.0 3.5.0 3.8.8 - 11.1.0 + 12.0.1 1.6.0 1.6.13 3.2.7 diff --git a/postgresql-cqrs/README.md b/postgresql-cqrs/README.md index 47f982a..07b3b83 100644 --- a/postgresql-cqrs/README.md +++ b/postgresql-cqrs/README.md @@ -39,7 +39,7 @@ The last command will block the current terminal, so to continue you need to ope #### Initiate the test scenario: In a new Terminal enter the following command: ```bash -curl -L 'http://localhost:8080/shipping/register-order' \ +curl -L 'http://localhost:8080/shipping/register-order' \ -X POST \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ @@ -56,7 +56,7 @@ curl -L 'http://localhost:8080/shipping/register-order' \ #### Complete the test scenario: In the same Terminal enter the following command: ```bash -curl -L 'http://localhost:8080/shipping/ship-order' \ +curl -L 'http://localhost:8080/shipping/ship-order' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ diff --git a/postgresql-cqrs/src/main/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/shipping/adapters/kafka/outgoing/ShippingEventKafkaPublisher.java b/postgresql-cqrs/src/main/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/shipping/adapters/kafka/outgoing/ShippingEventKafkaPublisher.java index 3794da1..321e359 100644 --- a/postgresql-cqrs/src/main/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/shipping/adapters/kafka/outgoing/ShippingEventKafkaPublisher.java +++ b/postgresql-cqrs/src/main/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/shipping/adapters/kafka/outgoing/ShippingEventKafkaPublisher.java @@ -18,16 +18,18 @@ import dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType; import dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.processor.*; -import dk.cloudcreate.essentials.components.foundation.messaging.MessageHandler; +import dk.cloudcreate.essentials.components.foundation.messaging.*; import dk.cloudcreate.essentials.components.foundation.messaging.queue.OrderedMessage; import dk.cloudcreate.essentials.spring.examples.postgresql.cqrs.shipping.domain.ShippingOrders; import dk.cloudcreate.essentials.spring.examples.postgresql.cqrs.shipping.domain.events.OrderShipped; +import jakarta.validation.ConstraintViolationException; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.producer.ProducerRecord; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; +import java.time.Duration; import java.util.List; @Service @@ -53,6 +55,19 @@ protected List reactsToEventsRelatedToAggregateTypes() { return List.of(ShippingOrders.AGGREGATE_TYPE); } + @Override + protected RedeliveryPolicy getInboxRedeliveryPolicy() { + // Example of a custom inbox redelivery policy which doesn't perform retries in case message handling experiences a ConstraintViolationException + return RedeliveryPolicy.exponentialBackoff() + .setInitialRedeliveryDelay(Duration.ofMillis(200)) + .setFollowupRedeliveryDelay(Duration.ofMillis(200)) + .setFollowupRedeliveryDelayMultiplier(1.1d) + .setMaximumFollowupRedeliveryDelayThreshold(Duration.ofSeconds(3)) + .setMaximumNumberOfRedeliveries(20) + .setDeliveryErrorHandler(MessageDeliveryErrorHandler.stopRedeliveryOn(ConstraintViolationException.class)) + .build(); + } + @MessageHandler void handle(OrderShipped e, OrderedMessage eventMessage) { log.info("*** Received {} for Order '{}' and adding it to the Outbox as a {} message", e.getClass().getSimpleName(), e.orderId, ExternalOrderShipped.class.getSimpleName()); diff --git a/postgresql-cqrs/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/task/TaskProcessorIT.java b/postgresql-cqrs/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/task/TaskProcessorIT.java index 62d79df..cf23ffa 100644 --- a/postgresql-cqrs/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/task/TaskProcessorIT.java +++ b/postgresql-cqrs/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/cqrs/task/TaskProcessorIT.java @@ -92,7 +92,7 @@ protected void collectPersistedEvents() { @Test public void create_task_and_comment_in_same_unit_of_work() { collectPersistedEvents(); - Awaitility.waitAtMost(Duration.ofMillis(300)).until(() -> eventProcessor.isActive()); + Awaitility.waitAtMost(Duration.ofMillis(500)).until(() -> eventProcessor.isActive()); TaskId taskId = TaskId.random(); String comment = "This is a good comment!"; diff --git a/postgresql-inbox-outbox/README.md b/postgresql-inbox-outbox/README.md index e51a142..60dabdb 100644 --- a/postgresql-inbox-outbox/README.md +++ b/postgresql-inbox-outbox/README.md @@ -21,7 +21,7 @@ The last command will block the current terminal, so to continue you need to ope #### Initiate the test scenario: In a new Terminal enter the following command: ```bash -curl -L 'http://localhost:8080/shipping/register-order' \ +curl -L 'http://localhost:8080/shipping/register-order' \ -X POST \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ @@ -38,7 +38,7 @@ curl -L 'http://localhost:8080/shipping/register-order' \ #### Complete the test scenario: In the same Terminal enter the following command: ```bash -curl -L 'http://localhost:8080/shipping/ship-order' \ +curl -L 'http://localhost:8080/shipping/ship-order' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ diff --git a/postgresql-inbox-outbox/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/messaging/DurableQueuesLoadIT.java b/postgresql-inbox-outbox/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/messaging/DurableQueuesLoadIT.java index b8bcb64..ec87c11 100644 --- a/postgresql-inbox-outbox/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/messaging/DurableQueuesLoadIT.java +++ b/postgresql-inbox-outbox/src/test/java/dk/cloudcreate/essentials/spring/examples/postgresql/messaging/DurableQueuesLoadIT.java @@ -98,7 +98,7 @@ void queue_a_large_number_of_messages() { .setQueueMessageHandler(msgHandler) .build()); - var count = 20000; + var count = 10000; var stopwatch = StopWatch.start(); unitOfWorkFactory.usingUnitOfWork(uow -> { IntStream.range(0, count).forEach(i -> {