private RpcManager(final SchemaContext schemaContext,
final DOMRpcProviderService rpcProvisionRegistry,
- final DOMRpcService rpcSevices) {
+ final DOMRpcService rpcSevices,
+ final RemoteRpcProviderConfig config) {
this.schemaContext = schemaContext;
this.rpcProvisionRegistry = rpcProvisionRegistry;
rpcServices = rpcSevices;
- config = new RemoteRpcProviderConfig(getContext().system().settings().config());
+ this.config = config;
createRpcActors();
startListeners();
public static Props props(final SchemaContext schemaContext,
- final DOMRpcProviderService rpcProvisionRegistry, final DOMRpcService rpcServices) {
+ final DOMRpcProviderService rpcProvisionRegistry, final DOMRpcService rpcServices,
+ final RemoteRpcProviderConfig config) {
Preconditions.checkNotNull(schemaContext, "SchemaContext can not be null!");
Preconditions.checkNotNull(rpcProvisionRegistry, "RpcProviderService can not be null!");
Preconditions.checkNotNull(rpcServices, "RpcService can not be null!");
- return Props.create(RpcManager.class, schemaContext, rpcProvisionRegistry, rpcServices);
+ return Props.create(RpcManager.class, schemaContext, rpcProvisionRegistry, rpcServices, config);
}
private void createRpcActors() {
LOG.debug("Create rpc registry and broker actors");
rpcRegistry =
- getContext().actorOf(RpcRegistry.props().
+ getContext().actorOf(RpcRegistry.props(config).
withMailbox(config.getMailBoxName()), config.getRpcRegistryName());
rpcBroker =
- getContext().actorOf(RpcBroker.props(rpcServices, rpcRegistry).
+ getContext().actorOf(RpcBroker.props(rpcServices).
withMailbox(config.getMailBoxName()), config.getRpcBrokerName());
final RpcRegistry.Messages.SetLocalRouter localRouter = new RpcRegistry.Messages.SetLocalRouter(rpcBroker);
LOG.debug("Registers rpc listeners");
rpcListener = new RpcListener(rpcRegistry);
- rpcImplementation = new RemoteRpcImplementation(rpcBroker, config);
+ rpcImplementation = new RemoteRpcImplementation(rpcRegistry, config);
rpcServices.registerRpcListener(rpcListener);
}
private void registerRoutedRpcDelegate() {
- Set<DOMRpcIdentifier> rpcIdentifiers = new HashSet<>();
- Set<Module> modules = schemaContext.getModules();
- for(Module module : modules){
- for(RpcDefinition rpcDefinition : module.getRpcs()){
+ final Set<DOMRpcIdentifier> rpcIdentifiers = new HashSet<>();
+ final Set<Module> modules = schemaContext.getModules();
+ for(final Module module : modules){
+ for(final RpcDefinition rpcDefinition : module.getRpcs()){
if(RpcRoutingStrategy.from(rpcDefinition).isContextBasedRouted()) {
LOG.debug("Adding routed rpcDefinition for path {}", rpcDefinition.getPath());
rpcIdentifiers.add(DOMRpcIdentifier.create(rpcDefinition.getPath(), YangInstanceIdentifier.EMPTY));
for (final RpcDefinition rpcDef : currentlySupportedRpc) {
rpcs.add(DOMRpcIdentifier.create(rpcDef.getPath()));
}
- rpcListener.onRpcAvailable(rpcs);
+ if(!rpcs.isEmpty()) {
+ rpcListener.onRpcAvailable(rpcs);
+ }
}