private CommandClient setCommandTimeOut(final CommandClient commandClient) { commandClient.setRequestTimeout(commandTimeoutInMs); return commandClient; }
private CommandClient setRequestTimeOut(final CommandClient commandClient) { commandClient.setRequestTimeout(TimeUnit.SECONDS.toMillis(requestTimeoutInSecs)); return commandClient; }
/** * Create a command client for the device for that a {@link TimeUntilDisconnectNotification} was received, if no such * command client is already active. * @param notification The notification that was received for the device. */ private Future<CommandClient> createCommandClientAndSendCommand(final TimeUntilDisconnectNotification notification) { return honoClient.getOrCreateCommandClient(notification.getTenantId(), notification.getDeviceId()) .map(commandClient -> { commandClient.setRequestTimeout(calculateCommandTimeout(notification)); // send the command upstream to the device if (SEND_ONE_WAY_COMMANDS) { sendOneWayCommandToAdapter(commandClient, notification); } else { sendCommandToAdapter(commandClient, notification); } return commandClient; }).otherwise(t -> { LOG.error("Could not create command client", t); return null; }); }