/** * Creates Akka configuration object for this actor. * * @param connection the connection. * @param conciergeForwarder the actor used to send signals to the concierge service. * @return the Akka configuration Props object. */ public static Props props(final Connection connection, final ActorRef conciergeForwarder) { return Props.create(MqttClientActor.class, validateConnection(connection), connection.getConnectionStatus(), conciergeForwarder); }
/** * Creates Akka configuration object for this actor. * * @param connection the connection. * @param conciergeForwarder the actor used to send signals to the concierge service. * @return the Akka configuration Props object. */ public static Props props(final Connection connection, final ActorRef conciergeForwarder) { return Props.create(RabbitMQClientActor.class, validateConnection(connection), connection.getConnectionStatus(), conciergeForwarder); }
/** * Creates Akka configuration object for this actor. * * @param connection the connection. * @param conciergeForwarder the actor used to send signals to the concierge service. * @return the Akka configuration Props object. */ public static Props props(final Connection connection, final ActorRef conciergeForwarder) { return Props.create(MqttClientActor.class, validateConnection(connection), connection.getConnectionStatus(), conciergeForwarder); }
/** * Creates Akka configuration object for this actor. * * @param connection the connection. * @param conciergeForwarder the actor used to send signals to the concierge service. * @return the Akka configuration Props object. */ public static Props props(final Connection connection, final ActorRef conciergeForwarder) { return Props.create(AmqpClientActor.class, validateConnection(connection), connection.getConnectionStatus(), conciergeForwarder); }
/** * Creates Akka configuration object for this actor. * * @param connection the connection. * @param conciergeForwarder the actor used to send signals to the concierge service. * @return the Akka configuration Props object. */ public static Props props(final Connection connection, final ActorRef conciergeForwarder) { return Props.create(RabbitMQClientActor.class, validateConnection(connection), connection.getConnectionStatus(), conciergeForwarder); }
/** * Creates Akka configuration object for this actor. * * @param connection the connection. * @param conciergeForwarder the actor used to send signals to the concierge service. * @return the Akka configuration Props object. */ public static Props props(final Connection connection, final ActorRef conciergeForwarder) { return Props.create(AmqpClientActor.class, validateConnection(connection), connection.getConnectionStatus(), conciergeForwarder); }
private void retrieveConnectionStatus(final RetrieveConnectionStatus command) { checkConnectionNotNull(); getSender().tell(RetrieveConnectionStatusResponse.of(connectionId, connection.getConnectionStatus(), command.getDittoHeaders()), getSelf()); }
private void retrieveConnectionStatus(final RetrieveConnectionStatus command) { checkConnectionNotNull(); getSender().tell(RetrieveConnectionStatusResponse.of(connectionId, connection.getConnectionStatus(), command.getDittoHeaders()), getSelf()); }
private void handleModifyConnection(final ModifyConnection command, final ActorRef origin) { checkNotNull(connection, "Connection"); final ActorRef self = getSelf(); final ActorRef parent = getContext().getParent(); final DittoHeaders dittoHeaders = command.getDittoHeaders(); final ConnectivityCommandResponse commandResponse = ModifyConnectionResponse.modified(connectionId, dittoHeaders); if (ConnectionStatus.OPEN.equals(connection.getConnectionStatus())) { final OpenConnection openConnectionAfterModification = OpenConnection.of(connectionId, dittoHeaders); log.debug("Desired connection state is {}, forwarding {} to client actor.", connection.getConnectionStatus(), openConnectionAfterModification); askClientActor(openConnectionAfterModification, response -> { final PerformTask performTask = new PerformTask("subscribe for events and schedule ModifyConnectionResponse", subscribeForEventsAndScheduleResponse(commandResponse, origin)); parent.tell(ConnectionSupervisorActor.ManualReset.getInstance(), self); self.tell(performTask, ActorRef.noSender()); }, error -> handleException("connect-after-modify", origin, error) ); } else { log.debug("Desired connection state is {}, do not open connection.", connection.getConnectionStatus()); origin.tell(commandResponse, getSelf()); } }
private void handleModifyConnection(final ModifyConnection command, final ActorRef origin) { checkNotNull(connection, "Connection"); final ActorRef self = getSelf(); final ActorRef parent = getContext().getParent(); final DittoHeaders dittoHeaders = command.getDittoHeaders(); final ConnectivityCommandResponse commandResponse = ModifyConnectionResponse.modified(connectionId, dittoHeaders); if (ConnectionStatus.OPEN.equals(connection.getConnectionStatus())) { final OpenConnection openConnectionAfterModification = OpenConnection.of(connectionId, dittoHeaders); log.debug("Desired connection state is {}, forwarding {} to client actor.", connection.getConnectionStatus(), openConnectionAfterModification); askClientActor(openConnectionAfterModification, response -> { final PerformTask performTask = new PerformTask("subscribe for events and schedule ModifyConnectionResponse", subscribeForEventsAndScheduleResponse(commandResponse, origin)); parent.tell(ConnectionSupervisorActor.ManualReset.getInstance(), self); self.tell(performTask, ActorRef.noSender()); }, error -> handleException("connect-after-modify", origin, error) ); } else { log.debug("Desired connection state is {}, do not open connection.", connection.getConnectionStatus()); origin.tell(commandResponse, getSelf()); } }
/** * Returns a new {@code ConnectionBuilder} object. * * @param connection the connection to use for initializing the builder. * @return new instance of {@code ImmutableConnectionBuilder}. * @throws NullPointerException if {@code connection} is {@code null}. */ public static ConnectionBuilder getBuilder(final Connection connection) { checkNotNull(connection, "Connection"); return new Builder(connection.getConnectionType()) .id(connection.getId()) .connectionStatus(connection.getConnectionStatus()) .credentials(connection.getCredentials().orElse(null)) .uri(connection.getUri()) .trustedCertificates(connection.getTrustedCertificates().orElse(null)) .failoverEnabled(connection.isFailoverEnabled()) .validateCertificate(connection.isValidateCertificates()) .processorPoolSize(connection.getProcessorPoolSize()) .sources(connection.getSources()) .targets(connection.getTargets()) .clientCount(connection.getClientCount()) .specificConfig(connection.getSpecificConfig()) .mappingContext(connection.getMappingContext().orElse(null)) .name(connection.getName().orElse(null)) .tags(connection.getTags()); }
/** * Returns a new {@code ConnectionBuilder} object. * * @param connection the connection to use for initializing the builder. * @return new instance of {@code ImmutableConnectionBuilder}. * @throws NullPointerException if {@code connection} is {@code null}. */ public static ConnectionBuilder getBuilder(final Connection connection) { checkNotNull(connection, "Connection"); return new Builder(connection.getConnectionType()) .id(connection.getId()) .connectionStatus(connection.getConnectionStatus()) .credentials(connection.getCredentials().orElse(null)) .uri(connection.getUri()) .trustedCertificates(connection.getTrustedCertificates().orElse(null)) .failoverEnabled(connection.isFailoverEnabled()) .validateCertificate(connection.isValidateCertificates()) .processorPoolSize(connection.getProcessorPoolSize()) .sources(connection.getSources()) .targets(connection.getTargets()) .clientCount(connection.getClientCount()) .specificConfig(connection.getSpecificConfig()) .mappingContext(connection.getMappingContext().orElse(null)) .name(connection.getName().orElse(null)) .tags(connection.getTags()); }
getContext().become(connectionCreatedBehaviour); if (ConnectionStatus.OPEN.equals(connection.getConnectionStatus())) { log.debug("Connection <{}> has status <{}> and will therefore be opened.", connection.getId(), connection.getConnectionStatus().getName()); final OpenConnection openConnection = OpenConnection.of(connectionId, command.getDittoHeaders()); askClientActor(openConnection, log.debug("Connection <{}> has status <{}> and will therefore stay closed.", connection.getId(), connection.getConnectionStatus().getName()); respondWithCreateConnectionResponse(connection, command, origin);
getContext().become(connectionCreatedBehaviour); if (ConnectionStatus.OPEN.equals(connection.getConnectionStatus())) { log.debug("Connection <{}> has status <{}> and will therefore be opened.", connection.getId(), connection.getConnectionStatus().getName()); final OpenConnection openConnection = OpenConnection.of(connectionId, command.getDittoHeaders()); askClientActor(openConnection, log.debug("Connection <{}> has status <{}> and will therefore stay closed.", connection.getId(), connection.getConnectionStatus().getName()); respondWithCreateConnectionResponse(connection, command, origin);
log.info("Connection <{}> was recovered: {}", connectionId, connection); if (connection != null) { if (ConnectionStatus.OPEN.equals(connection.getConnectionStatus())) { log.debug("Opening connection <{}> after recovery.", connectionId);
log.info("Connection <{}> was recovered: {}", connectionId, connection); if (connection != null) { if (ConnectionStatus.OPEN.equals(connection.getConnectionStatus())) { log.debug("Opening connection <{}> after recovery.", connectionId);