Skip to content

json-rpc: add json-rpc invoker #3921

@jknack

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;
     })
   );
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions