Automatically rebuild the state after a crash / restart
[demos/kafka/demos-kafka-payment-system-transfer] / src / main / java / de / juplo / kafka / payment / transfer / adapter / TransferController.java
index 8240310..5f30df6 100644 (file)
@@ -24,7 +24,8 @@ import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 
 
-@RestController
+@RequestMapping(TransferController.PATH)
+@ResponseBody
 @RequiredArgsConstructor
 @Slf4j
  public class TransferController
@@ -36,7 +37,7 @@ import java.util.concurrent.CompletableFuture;
 
 
   @PostMapping(
-      path = PATH,
+      path = "",
       consumes = MediaType.APPLICATION_JSON_VALUE,
       produces = MediaType.APPLICATION_JSON_VALUE)
   public DeferredResult<ResponseEntity<?>> transfer(
@@ -63,7 +64,6 @@ import java.util.concurrent.CompletableFuture;
                             .payer(transferDTO.getPayer())
                             .payee(transferDTO.getPayee())
                             .amount(transferDTO.getAmount())
-                            .state(Transfer.State.RECEIVED)
                             .build())
                     .thenApply($ ->
                         ResponseEntity
@@ -86,7 +86,7 @@ import java.util.concurrent.CompletableFuture;
   }
 
   @GetMapping(
-      path = PATH + "/{id}",
+      path = "/{id}",
       produces = MediaType.APPLICATION_JSON_VALUE)
   public ResponseEntity<TransferDTO> get(@PathVariable Long id)
   {