Add outbox module: Transactional Outbox with the Spring Modulith Event Publication Registry
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
$ mvn -pl outbox -am test -Dtest=RegistrySafetyNetTest
|
||||
(real embedded Kafka broker via @EmbeddedKafka; BillingManagement.issueInvoice()
|
||||
publishes InvoiceIssued, @Externalized("invoices::#{#this.invoiceId}") routes it
|
||||
through spring-modulith-events-kafka)
|
||||
|
||||
Kafka record received -- topic=invoices key=1 value={"invoiceId":1,"sku":"GADGET-7","amountCents":4500}
|
||||
EVENT_PUBLICATION_ARCHIVE rows for InvoiceIssued: 2
|
||||
EVENT_PUBLICATION rows still outstanding for InvoiceIssued: 0
|
||||
|
||||
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
|
||||
|
||||
The message really arrived on the real topic, with the real routing key (the invoice's
|
||||
own id, exactly as the SpEL expression after "::" in @Externalized specifies) and the
|
||||
real JSON payload. Two archive rows for InvoiceIssued, not one, because this module's
|
||||
test sources also declare FlakyAuditListener (see output/02) -- it is a second,
|
||||
independent listener on the same event, and with completion-mode=ARCHIVE configured in
|
||||
application.properties, both listeners' completed publications moved out of
|
||||
EVENT_PUBLICATION and into EVENT_PUBLICATION_ARCHIVE once they succeeded. Zero rows
|
||||
left outstanding in EVENT_PUBLICATION for this event type confirms neither listener is
|
||||
still pending.
|
||||
Reference in New Issue
Block a user