Skip to content

Commit

Permalink
split log for targets and replayTarget into separate statements;
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Maute <stefan.maute@bosch.io>
  • Loading branch information
Stefan Maute committed May 26, 2021
1 parent cab53d0 commit 46d09ee
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,29 @@ private int computeMaxAckPayloadBytesForSignal(final OutboundSignal.MultiMapped
private Stream<SendingOrDropped> sendMappedOutboundSignal(final OutboundSignal.Mapped outbound,
final int maxPayloadBytesForSignal) {

final ExternalMessage message = outbound.getExternalMessage();
final var message = outbound.getExternalMessage();
final String correlationId = message.getHeaders().get(CORRELATION_ID.getKey());
final Signal<?> outboundSource = outbound.getSource();
final List<Target> outboundTargets = outbound.getTargets();

final ThreadSafeDittoLoggingAdapter l = logger.withCorrelationId(correlationId);
l.debug("Publishing mapped message of type <{}> to targets <{}>", outboundSource.getType(), outboundTargets);

final Optional<SendingContext> replyTargetSendingContext = getSendingContext(outbound);

final List<SendingContext> sendingContexts = replyTargetSendingContext.map(List::of)
final List<SendingContext> sendingContexts = replyTargetSendingContext
.map(sendingContext -> {
l.debug("Publishing mapped message of type <{}> to replyTarget <{}>",
outboundSource.getType(), sendingContext.getGenericTarget().getAddress());
return List.of(sendingContext);
})
.orElseGet(() -> outboundTargets.stream()
.map(target -> getSendingContextForTarget(outbound, target))
.map(target -> {
l.debug("Publishing mapped message of type <{}> to targets <{}>", outboundSource.getType(),
outboundTargets);
return getSendingContextForTarget(outbound, target);
})
.collect(Collectors.toList()));


if (sendingContexts.isEmpty()) {
// Message dropped: neither reply-target nor target is available for the message.
if (l.isDebugEnabled()) {
Expand Down

0 comments on commit 46d09ee

Please sign in to comment.