@Override public void accept(final ConnectivityCommand<?> command) { switch (command.getType()) { case CreateConnection.TYPE: case TestConnection.TYPE: case ModifyConnection.TYPE: final Connection connection = getConnectionFromCommand(command); if (connection != null) { connectionValidator.validate(connection, command.getDittoHeaders()); propsFactory.getActorPropsForType(connection, conciergeForwarder); } else { // should never happen throw new IllegalStateException("connection=null in " + command); } break; default: //nothing to validate for other commands } } }
@Override public void accept(final ConnectivityCommand<?> command) { switch (command.getType()) { case CreateConnection.TYPE: case TestConnection.TYPE: case ModifyConnection.TYPE: final Connection connection = getConnectionFromCommand(command); if (connection != null) { connectionValidator.validate(connection, command.getDittoHeaders()); propsFactory.getActorPropsForType(connection, conciergeForwarder); } else { // should never happen throw new IllegalStateException("connection=null in " + command); } break; default: //nothing to validate for other commands } } }
private void startClientActorIfRequired() { checkNotNull(connectionId, "connectionId"); checkConnectionNotNull(); if (clientActorRouter == null) { final int clientCount = connection.getClientCount(); log.info("Starting ClientActor for connection <{}> with <{}> clients.", connectionId, clientCount); final Props props = propsFactory.getActorPropsForType(connection, conciergeForwarder); final ClusterRouterPoolSettings clusterRouterPoolSettings = new ClusterRouterPoolSettings(clientCount, 1, true, Collections.singleton(CLUSTER_ROLE)); final RoundRobinPool roundRobinPool = new RoundRobinPool(clientCount); final Props clusterRouterPoolProps = new ClusterRouterPool(roundRobinPool, clusterRouterPoolSettings).props(props); // start client actor without name so it does not conflict with its previous incarnation clientActorRouter = getContext().actorOf(clusterRouterPoolProps); } else { log.debug("ClientActor already started."); } }
private void startClientActorIfRequired() { checkNotNull(connectionId, "connectionId"); checkConnectionNotNull(); if (clientActorRouter == null) { final int clientCount = connection.getClientCount(); log.info("Starting ClientActor for connection <{}> with <{}> clients.", connectionId, clientCount); final Props props = propsFactory.getActorPropsForType(connection, conciergeForwarder); final ClusterRouterPoolSettings clusterRouterPoolSettings = new ClusterRouterPoolSettings(clientCount, 1, true, Collections.singleton(CLUSTER_ROLE)); final RoundRobinPool roundRobinPool = new RoundRobinPool(clientCount); final Props clusterRouterPoolProps = new ClusterRouterPool(roundRobinPool, clusterRouterPoolSettings).props(props); // start client actor without name so it does not conflict with its previous incarnation clientActorRouter = getContext().actorOf(clusterRouterPoolProps); } else { log.debug("ClientActor already started."); } }