Last active
November 22, 2020 21:56
-
-
Save razorcd/6eaf4b9875d42838df1da46f14de90b1 to your computer and use it in GitHub Desktop.
Scaling reactive APIs - www.razorcodes.com
This file contains hidden or 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 | |
@RequiredArgsConstructor | |
public class CustomerListener { | |
private final CustomerRepository<CustomerUpdatedEvent> customerRepository; | |
@StreamListener("customer-events") | |
public void customerEventsConsumer(Flux<DataUpdatedEvent> event) { | |
event.map(this::parseEvent) | |
.doOnNext(MyService::doBusinessLogic) // returns CustomerUpdatedEvent | |
.subscribe(customerRepository::save); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment