chatRoomInfo.getId(),
chatHomeService
.getChatRoomData(chatRoomInfo.getId())
- .flatMapMany(chatRoomData -> chatRoomData.getMessages()))));
- }
-
- default void writeChatRoomData(UUID chatRoomId, Flux<Message> messageFlux)
- {
- writeChatRoomData(
- chatRoomId,
- messageFlux,
- (id) -> logSuccess(id),
- (id, throwable) -> logFailure(id, throwable));
+ .flatMapMany(chatRoomData -> chatRoomData.getMessages()),
+ this::logSuccess,
+ this::logFailure)));
}
void writeChatRoomInfo(Flux<ChatRoomInfo> chatRoomInfoFlux);
Flux<ChatRoomInfo> readChatRoomInfo();
- void writeChatRoomData(
+ default void writeChatRoomData(
UUID chatRoomId,
Flux<Message> messageFlux,
- SuccessCallback callback,
- FailureCallback failureCallback);
+ SuccessCallback successCallback,
+ FailureCallback failureCallback)
+ {
+ writeChatRoomData(
+ chatRoomId,
+ messageFlux
+ .doOnComplete(() -> successCallback.accept(chatRoomId))
+ .doOnError(throwable -> failureCallback.accept(chatRoomId, throwable)));
+ }
+ void writeChatRoomData(UUID chatRoomId, Flux<Message> messageFlux);
Flux<Message> readChatRoomData(UUID chatRoomId);
interface SuccessCallback extends Consumer<UUID> {}