diff --git a/src/main/java/com/loafle/commons/rpc/registry/RPCRegistry.java b/src/main/java/com/loafle/commons/rpc/registry/RPCRegistry.java index b877c1f..4bceed0 100644 --- a/src/main/java/com/loafle/commons/rpc/registry/RPCRegistry.java +++ b/src/main/java/com/loafle/commons/rpc/registry/RPCRegistry.java @@ -38,6 +38,18 @@ public class RPCRegistry implements RPCInvoker { return rService; } + public void registerService(Object receiver, Map methods) throws RPCException { + this.registerService(receiver, receiver.getClass().getName(), methods); + } + + public void registerService(Object receiver, String name, Map methods) throws RPCException { + RPCService rService = this.registerService(receiver, name); + + methods.forEach((methodName, method)->{ + rService.registerMethod(method, methodName); + }); + } + @Override public boolean hasMethod(String method) { String[] sm = method.split(".");