/** * Settles the command message with the <em>released</em> outcome. * <p> * This method simply invokes {@link CommandContext#release(int)} with * 0 credits. */ public void release() { release(0); }
private long startTimer(final Integer msgId) { LOG.trace("Start a timer for [{}] ms", config.getCommandAckTimeout()); return vertx.setTimer(config.getCommandAckTimeout(), timerId -> { LOG.trace("Timer [{}] expired", timerId); Optional.ofNullable(removeFromWaitingForAcknowledgement(msgId)).ifPresent(value -> { final CommandSubscription subscription = value.two(); final CommandContext commandContext = value.three(); LOG.debug( "Timed out waiting for acknowledgment for command sent to device [tenant-id: {}, device-id: {}, MQTT client-id: {}, QoS: {}]", subscription.getTenant(), subscription.getDeviceId(), subscription.getClientId(), subscription.getQos()); final Map<String, String> items = new HashMap<>(3); items.put(Fields.EVENT, "Timed out waiting for acknowledgment for command sent to device"); items.put(TracingHelper.TAG_CLIENT_ID.getKey(), subscription.getClientId()); items.put(TracingHelper.TAG_QOS.getKey(), subscription.getQos().toString()); commandContext.getCurrentSpan().log(items); commandContext.release(1); }); }); }
if (responseReady.isComplete()) { commandContext.release(); } else {
if (responseReady.isComplete()) { commandContext.release(); } else {
sentHandler.cause()); TracingHelper.logError(commandContext.getCurrentSpan(), sentHandler.cause()); commandContext.release(1);
private Future<MessageConsumer> createCommandConsumer( final ProtonSender sender, final ResourceIdentifier sourceAddress) { return getCommandConnection().createCommandConsumer( sourceAddress.getTenantId(), sourceAddress.getResourceId(), commandContext -> { Tags.COMPONENT.set(commandContext.getCurrentSpan(), getTypeName()); final Command command = commandContext.getCommand(); if (!command.isValid()) { final Exception ex = new ClientErrorException(HttpURLConnection.HTTP_BAD_REQUEST, "malformed command message"); commandContext.reject(AmqpContext.getErrorCondition(ex), 1); } else if (!sender.isOpen()) { commandContext.release(1); } else { onCommandReceived(sender, commandContext); } }, closeHandler -> {}, DEFAULT_COMMAND_CONSUMER_CHECK_INTERVAL_MILLIS); }
commandContext.getCurrentSpan().log("failed to forward command to device in HTTP response body"); TracingHelper.logError(commandContext.getCurrentSpan(), t); commandContext.release(); final CommandContext commandContext = ctx.get(CommandContext.KEY_COMMAND_CONTEXT); if (commandContext != null) { commandContext.release();
commandContext.getCurrentSpan().log("failed to forward command to device in HTTP response body"); TracingHelper.logError(commandContext.getCurrentSpan(), t); commandContext.release(); final CommandContext commandContext = ctx.get(CommandContext.KEY_COMMAND_CONTEXT); if (commandContext != null) { commandContext.release();