We currently use some custom commands with Infinispan. We have since moved over to wanting to use a custom command with a return value for the response.
We have tried using the various methods on the RpcManager and have found a few issues.
1. Map<Address, Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpc, boolean sync, boolean usePriorityQueue) throws RpcException;
This method always returns a null for cluster responses. This is a simple issue that can be solved with the following diff
The SingleRpcCommand wraps the given command always forcing the return value expectation to be false.
2. Map<Address, Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout);
This method doesn't wrap the return value in a Response thus causing a ClassCastException when the client node gets the response back. I haven't looked into detail with this one yet.
If needed I can send a sample project that shows the behavior.