Automatically rebuild the state after a crash / restart
authorKai Moritz <kai@juplo.de>
Tue, 15 Jun 2021 18:27:20 +0000 (20:27 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 19 Jun 2021 16:19:52 +0000 (18:19 +0200)
commitedc88d6eac8c502ab0297380489ccc9ba706b5f0
tree0dda993722c99e931ae72ebfcbf3bfc894b3590f
parent26809d379a0e024017f70db8c70382f94faf98b6
Automatically rebuild the state after a crash / restart

* Turning of enable.auto.commit and setting auto.offset.reset to earliest
  does the trick in this setup.
* Since no offset-commits are made, all events are re-read on startup.
* The TransferConsumer uses a special instance of TransferService, that
  is initialized with a NoOpMessageService, to replay the restored
  events without generating new events.
src/main/java/de/juplo/kafka/payment/transfer/TransferServiceApplication.java
src/main/java/de/juplo/kafka/payment/transfer/adapter/NoOpMessageService.java [new file with mode: 0644]
src/main/java/de/juplo/kafka/payment/transfer/adapter/TransferConsumer.java
src/main/java/de/juplo/kafka/payment/transfer/adapter/TransferController.java
src/main/java/de/juplo/kafka/payment/transfer/domain/TransferService.java