-
1. Re: Disable custom RPC on node?
rvansa Jan 23, 2017 12:30 PM (in response to mdobrinin)Could you clarify what are those "custom RPCs"? And the term "consumer of clustered caches" is not crystal clear either.
If you want to disable writes on certain nodes, you can use Security features.
-
2. Re: Disable custom RPC on node?
mdobrinin Jan 23, 2017 12:58 PM (in response to rvansa)By custom RPC, I mean a command that implements VisitableCommand or ReplicableCommand. I use the term custom to distinguish it from the default commands in Infinispan like PutKeyValueCommand. These base ones would need to get through for the clustered caches to keep working correctly on those nodes. Essentially, I want certain nodes to be able to read and write to clustered caches, but not process any third party commands.
-
3. Re: Disable custom RPC on node?
mdobrinin Jan 23, 2017 2:09 PM (in response to mdobrinin)I did find the VisitableCommand.shouldInvoke() interface method and this seems to work. Is this the preferred approach?
-
4. Re: Disable custom RPC on node?
rvansa Jan 24, 2017 3:32 AM (in response to mdobrinin)If you don't want to run those commands on certain nodes, don't send them there. If you want a second line of defense, if the command is a VisitableCommand, its acceptVisitor() method calls visitor.visitUnknownCommand() (or maybe another one if you inherit from existing commands). You can insert a custom interceptor on top of the stack on nodes where you don't want to execute those commands and filter them there. If the command does not step through the interceptor stack, you will need to do the check in its perform method directly, and you'll probably need to initialize it with some components. Check ModuleCommandInitializer and its uses in the query module for examples.
Using shouldInvoke() wouldn't be too convenient, because InvocationContext does not provide you the address of current node.
Anyway, custom commands is a pretty advanced hacking into Infinispan and you could end up relying on non-public API or API that we don't keep too stable. Is there a reason for custom commands rather than using Distributed Executors? Could you share some details what you're doing?
-
5. Re: Disable custom RPC on node?
mdobrinin Jan 25, 2017 10:50 AM (in response to rvansa)I believe this code was written against an old Infinispan version before the new executor API was available. I will try out your suggestions, thanks.