private <T> void dispatchMsg(ActorContext context, T localMsg, BiConsumer<String, T> biConsumer) { for (EndpointClusterAddress address : routes.getLocalRoutes()) { LOG.info("Forwarding {} to local endpoint actor {}", localMsg, address); ThriftEndpointActorMsg<T> msg = new ThriftEndpointActorMsg<>( address.toEndpointAddress(), ActorClassifier.LOCAL, localMsg); context.parent().tell(msg, context.self()); } for (EndpointClusterAddress address : routes.getRemoteRoutes()) { LOG.info("Forwarding {} to remote endpoint actor {}", localMsg, address); biConsumer.accept(address.getNodeId(), localMsg); } }