5 Replies Latest reply on Jan 25, 2017 10:50 AM by mdobrinin

    Disable custom RPC on node?

    mdobrinin

      I am on version 7.2 Is there a way to disable custom RPC method processing on a subset of nodes? Some of my nodes are meant to be consumers of clustered caches, but should not be reacting to any custom RPC calls.

        • 1. Re: Disable custom RPC on node?
          rvansa

          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

            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

              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

                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

                  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.