Skip to content

Commit

Permalink
apply signal transformer for sudo commands
Browse files Browse the repository at this point in the history
Signed-off-by: Yannic Klem <yannic.klem@bosch.io>
  • Loading branch information
Yannic92 committed Jul 25, 2022
1 parent 19a4c9b commit 96dad69
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,9 @@ private void forwardSudoCommandToChildIfAvailable(final SudoCommand<?> sudoComma
}

private void forwardDittoSudoToChildIfAvailable(final WithDittoHeaders withDittoHeaders) {
final var sender = sender();
if (null != persistenceActorChild) {
if (persistenceActorChild.equals(getSender())) {
if (persistenceActorChild.equals(sender)) {
log.withCorrelationId(withDittoHeaders)
.warning("Received unhandled WithDittoHeaders from persistenceActorChild '{}': {}", entityId,
withDittoHeaders);
Expand All @@ -536,10 +537,15 @@ private void forwardDittoSudoToChildIfAvailable(final WithDittoHeaders withDitto
} else {
SUDO_COMMANDS_COUNTER.increment();
}
persistenceActorChild.forward(withDittoHeaders, getContext());
if (withDittoHeaders instanceof Signal<?> signal) {
signalTransformer.apply(signal)
.thenAccept(transformed -> persistenceActorChild.tell(transformed, sender));
} else {
persistenceActorChild.tell(withDittoHeaders, sender);
}
}
} else {
replyUnavailableException(withDittoHeaders, getSender());
replyUnavailableException(withDittoHeaders, sender);
}
}

Expand Down

0 comments on commit 96dad69

Please sign in to comment.