Last active
January 4, 2021 12:28
-
-
Save JohnChangUK/5691900262eea5bfda16502670f90580 to your computer and use it in GitHub Desktop.
Create OrderPurchaseEvent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class OrderPurchaseProcessor { | |
private final Sinks.Many<OrderPurchaseEvent> sink; | |
@Autowired | |
public OrderPurchaseProcessor(Sinks.Many<OrderPurchaseEvent> sink) { | |
this.sink = sink; | |
} | |
public void process(OrderPurchase orderPurchase) { | |
OrderPurchaseEvent orderPurchaseEvent = new OrderPurchaseEvent() | |
.setUserId(orderPurchase.getUserId()) | |
.setOrderId(orderPurchase.getId()) | |
.setPrice(orderPurchase.getPrice()); | |
sink.emitNext(orderPurchaseEvent, Sinks.EmitFailureHandler.FAIL_FAST); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment