返回 Mono<Void 后的方法调用>
2022-09-02 05:27:16
我想在上一次返回时调用该方法: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());
}
方法返回 。sendEmail
Mono<Void>
那么如何打电话呢?saveNotificationLog
UPD:特林让我的问题更简单:
@Override
public Mono<Void> sendEmail(EmailDto emailDto) {
return mailReactiveClient.sendEmail(message ->
createMessage(emailDto, emailDto.getBody(), message))
.doOnNext(System.out.print("Hello world!");
}
返回后如何调用或类似方法?doOnNext
sendEmail
Mono<Void>