Skip to content

Instantly share code, notes, and snippets.

@JohnChangUK
Last active January 4, 2021 13:10
Show Gist options
  • Save JohnChangUK/c973d5ee1739bec3f3e455b94a61ba84 to your computer and use it in GitHub Desktop.
Save JohnChangUK/c973d5ee1739bec3f3e455b94a61ba84 to your computer and use it in GitHub Desktop.
PaymentEventHandler
public TransactionEvent handleEvent(PaymentEvent event) {
Mono.fromRunnable(() -> transactionRepository.save(
new Transaction()
.setOrderId(event.getOrderId())
.setPrice(event.getPrice())))
.subscribeOn(jdbcScheduler)
.subscribe();
return new TransactionEvent()
.orderId(event.getOrderId())
.status(() -> APPROVED.equals(event.getStatus())
? SUCCESSFUL
: UNSUCCESSFUL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment