Skip to content

Commit

Permalink
Fixed missing publish metrics for published messages without
Browse files Browse the repository at this point in the history
issued/requested acknowledgements

Signed-off-by: Yannic Klem <yannic.klem@bosch.io>
  • Loading branch information
Yannic92 committed May 11, 2021
1 parent 740abd2 commit 7d75817
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,8 @@ public Optional<CompletionStage<CommandResponse>> monitorAndAcknowledge(
.or(() -> ackFromNullResponse)
.or(() -> Optional.ofNullable(result).flatMap(SendResult::getCommandResponse));

updateSendMonitor(getSentFailure(error, ackFromNullResponse.isPresent()));
responseOrAlternatives.ifPresent(commandResponse -> updateAckMonitor(getAckFailure(commandResponse)));

if (error != null || responseOrAlternatives.isPresent()) {
updateSendMonitor(getSentFailure(error, ackFromNullResponse.isPresent()));
}
return responseOrAlternatives.orElse(null);
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void monitorLiveResponseSendFailureKeepOriginalResponse() {
}

@Test
public void monitorNothingAsShouldNotAcknowledgeAndOriginalResponseIsNull() {
public void monitorNoAckAsShouldNotAcknowledgeAndOriginalResponseIsNull() {
sendingContext = SendingContext.newBuilder()
.mappedOutboundSignal(mappedOutboundSignal)
.externalMessage(externalMessage)
Expand All @@ -298,7 +298,7 @@ public void monitorNothingAsShouldNotAcknowledgeAndOriginalResponseIsNull() {

final Optional<CompletionStage<CommandResponse>> result = underTest.monitorAndAcknowledge(exceptionConverter);

Mockito.verifyNoInteractions(publishedMonitor, acknowledgedMonitor);
Mockito.verifyNoInteractions(acknowledgedMonitor);
assertThat(result)
.hasValueSatisfying(resultFuture -> assertThat(resultFuture).isCompletedWithValue(commandResponse));
}
Expand Down

0 comments on commit 7d75817

Please sign in to comment.