First: I cannot find docs for custom command gateways in v4.4, see my other question: Custom Command Gateway - still supported?
Assuming they still are part of the framework: When I have
public interface MyCommandGateway {
void handleMyCommand(MyCommand cmd);
}
when I follow the 4.2 docs (“A void
return type will cause the method to return immediately, unless there are other indications on the method that one would want to wait, such as a timeout or declared exceptions.”) this will effectively result in a call equivalent to commandGateway.send(cmd)
.
How do I have to define my interface method signature, to achieve a sendAndWait(cmd)
behavior?
Background: I am converting kafka messages to axon commands in a Spring Kafka Handler and need to wait for success/failure to be able to do retry/errorHandling and sendAndWait
is sufficient for me, I do not want/need to define a custom error behavior. But I still would like to use a type safe, specific gateway that can explicitely handle my commands, instead of the generic one.
Thanks
Jan