Skip to content

Instantly share code, notes, and snippets.

@JohnChangUK
Last active January 4, 2021 12:28
Show Gist options
  • Save JohnChangUK/5691900262eea5bfda16502670f90580 to your computer and use it in GitHub Desktop.
Save JohnChangUK/5691900262eea5bfda16502670f90580 to your computer and use it in GitHub Desktop.
Create OrderPurchaseEvent
@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