Skip to content

Commit

Permalink
made isIdempotent in EdgeCommandForwarderActor public
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Jun 28, 2022
1 parent 8e88670 commit 06e56c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void forwardCommandViaPubSub(final Command<?> command,
.exceptionally(t -> handleException(t, sender))
.thenAccept(response -> handleResponse(response, sender));
} else {
pubSubMediator.tell(command, sender);
pubSubMediator.tell(message, sender);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ public static Props props(final ActorRef pubSubMediator, final ShardRegions shar
return Props.create(EdgeCommandForwarderActor.class, pubSubMediator, shardRegions, signalTransformer);
}

/**
* Determines whether the passed {@code command} is idempotent or not.
*
* @param command the command to check.
* @return whether the command is idempotent or not.
*/
public static boolean isIdempotent(final Command<?> command) {
return switch (command.getCategory()) {
case QUERY, MERGE, MODIFY, DELETE -> true;
default -> false;
};
}

@Override
public Receive createReceive() {
final Receive receiveExtension = EdgeCommandForwarderExtension.get(context().system())
Expand Down Expand Up @@ -201,13 +214,6 @@ private void forwardToThingSearch(final Command<?> command) {
getSender());
}

private static boolean isIdempotent(final Command<?> command) {
return switch (command.getCategory()) {
case QUERY, MERGE, MODIFY, DELETE -> true;
default -> false;
};
}

private void handleUnknownSignal(final Signal<?> signal) {
signalTransformer.apply(signal)
.thenAccept(transformedSignal -> {
Expand Down

0 comments on commit 06e56c0

Please sign in to comment.