Skip to content

json-rpc: add json-rpc invoker #3921

Description

@jknack

will be middleware interface using Optional<JsonRpcResponse> to support both standard calls and notifications. Enforces an exception-
safe architecture by requiring errors to be returned in the response.

public interface JsonRpcInvoker {
   Optional<JsonRpcResponse> invoke(Context ctx, JsonRpcRequest request, JsonRpcChain next);
}

They can be chained by:

{
   install(new JsonRpcModule(...)
     .invoker((ctx, req, next) -> {
        // do something before call
        var rsp = next.proceed(ctx, req);
        // do something after
       return rsp;
     })
   );
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions