TransferRepository does not need any synchronization
authorKai Moritz <kai@juplo.de>
Sun, 13 Jun 2021 21:40:56 +0000 (23:40 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 19 Jun 2021 16:02:03 +0000 (18:02 +0200)
commit4467c5240397a47b181106a0ae902ed1b71d0c5d
tree33c1fe02c8168bbdc95321d54e88f1527d41902a
parent540f0c5e8ef2c815d7ff37c7af2e119c448cbb1b
TransferRepository does not need any synchronization

* Only TransferService stores data in the repository
* Since alle instances of Transfer, that are handled by TransferService
  are received through a single topic, no synchronization is needed at
  all in the repository.
* This is, because records, that are received from a topic are guaranteed
  to be processed one after the other.
* The topic simply is the single source for processing requests and a
  KafkaConsumer never handles multiple records in parallel.
* Note: This implementation is not ready to run on multiple threads or
  nodes!
12 files changed:
src/main/java/de/juplo/kafka/payment/transfer/TransferServiceApplication.java
src/main/java/de/juplo/kafka/payment/transfer/TransferServiceProperties.java
src/main/java/de/juplo/kafka/payment/transfer/adapter/TransferConsumer.java [new file with mode: 0644]
src/main/java/de/juplo/kafka/payment/transfer/adapter/TransferController.java
src/main/java/de/juplo/kafka/payment/transfer/domain/Transfer.java
src/main/java/de/juplo/kafka/payment/transfer/domain/TransferService.java
src/main/java/de/juplo/kafka/payment/transfer/persistence/InMemoryTransferRepository.java
src/main/java/de/juplo/kafka/payment/transfer/ports/HandleTransferUseCase.java [new file with mode: 0644]
src/main/java/de/juplo/kafka/payment/transfer/ports/InitiateTransferUseCase.java [deleted file]
src/main/java/de/juplo/kafka/payment/transfer/ports/ReceiveTransferUseCase.java [new file with mode: 0644]
src/main/java/de/juplo/kafka/payment/transfer/ports/TransferRepository.java
src/test/java/de/juplo/kafka/payment/transfer/domain/TransferTest.java