I want to call the method when previous returned Mono<Void>
:
@Override
public Mono<Void> sendEmail(EmailDto emailDto) {
return mailReactiveClient.sendEmail(message ->
createMessage(emailDto, emailDto.getBody(), message))
.doOnNext(saveNotificationLog(emailDto)); //it's not work
}
private void saveNotificationLog(EmailDto emailDto) {
notificationLogReactiveRepository.save(NotificationLog.builder()
...
.build());
}
Method sendEmail
returns Mono<Void>
.
So how to call saveNotificationLog
?
UPD: Tring to make my question simplier:
@Override
public Mono<Void> sendEmail(EmailDto emailDto) {
return mailReactiveClient.sendEmail(message ->
createMessage(emailDto, emailDto.getBody(), message))
.doOnNext(System.out.print("Hello world!");
}
How to call doOnNext
or similar method after sendEmail
return Mono<Void>
?
notificationLogReactiveRepository
blocking? – Transaction