public IotHubMessageResult execute(com.microsoft.azure.sdk.iot.device.Message msg, Object context) { messageIdListStoredOnReceive.add(msg.getMessageId()); // add received messsage id to messageList return IotHubMessageResult.COMPLETE; } }
public void execute(IotHubStatusCode status, Object context){ Message msg = (Message) context; System.out.println("Device Client 3: IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
public void execute(IotHubStatusCode status, Object context) { Message msg = (Message) context; System.out.println("IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
public void execute(IotHubStatusCode status, Object context) { Message msg = (Message) context; System.out.println("IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status== IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
public void execute(IotHubStatusCode status, Object context) { Message msg = (Message) context; System.out.println("IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
public void execute(IotHubStatusCode status, Object context) { Message msg = (Message) context; System.out.println("IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
public void execute(IotHubStatusCode status, Object context){ Message msg = (Message) context; System.out.println("Device Client 1: IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
public void execute(IotHubStatusCode status, Object context){ Message msg = (Message) context; System.out.println("Device Client 2: IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
public void execute(IotHubStatusCode status, Object context) { Message msg = (Message) context; System.out.println("IoT Hub responded to message "+ msg.getMessageId() + " with status " + status.name()); if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE) { failedMessageListOnClose.add(msg.getMessageId()); } } }
private static boolean hasExpectedSystemProperties(Message msg) { if (msg.getCorrelationId() == null || !msg.getCorrelationId().equals(expectedCorrelationId)) { return false; } if (msg.getMessageId() == null || !msg.getMessageId().equals(expectedMessageId)) { return false; } //all system properties are as expected return true; }
protected static boolean hasExpectedSystemProperties(com.microsoft.azure.sdk.iot.device.Message msg) { if (msg.getCorrelationId() == null || !msg.getCorrelationId().equals(expectedCorrelationId)) { return false; } if (msg.getMessageId() == null || !msg.getMessageId().equals(expectedMessageId)) { return false; } //all system properties are as expected return true; }
/** * Setter for the expiryTime property. This setter uses relative time, not absolute time. * @param timeOut The time out for the message, in milliseconds, from the current time. */ public void setExpiryTime(long timeOut) { // Codes_SRS_MESSAGE_34_047: [The function shall set the message's expiry time.] long currentTime = System.currentTimeMillis(); this.expiryTime = currentTime + timeOut; logger.LogInfo("The message with messageid %s has expiry time as %s milliseconds and the message will expire on %s, method name is %s ", this.getMessageId(), timeOut, new Date(this.expiryTime), logger.getMethodName()); }
/** * Setter for the expiryTime property using absolute time * @param absoluteTimeout The time out for the message, in milliseconds. */ public void setAbsoluteExpiryTime(long absoluteTimeout) { // Codes_SRS_MESSAGE_34_038: [If the provided absolute expiry time is negative, an IllegalArgumentException shall be thrown.] if (absoluteTimeout < 0) { throw new IllegalArgumentException("ExpiryTime may not be negative"); } // Codes_SRS_MESSAGE_34_037: [The function shall set the message's expiry time to be the number of milliseconds since the epoch provided in absoluteTimeout.] this.expiryTime = absoluteTimeout; logger.LogInfo("The message with messageid %s has expiry time as %s milliseconds and the message will expire on %s, method name is %s ", this.getMessageId(), absoluteTimeout, new Date(this.expiryTime), logger.getMethodName()); }
/** * Verifies whether the message is expired or not * @return true if the message is expired, false otherwise */ public boolean isExpired() { boolean messageExpired; // Codes_SRS_MESSAGE_15_035: [The function shall return false if the expiryTime is set to 0.] if (this.expiryTime == 0) { messageExpired = false; } else { // Codes_SRS_MESSAGE_15_036: [The function shall return true if the current time is greater than the expiry time and false otherwise.] long currentTime = System.currentTimeMillis(); if (currentTime > expiryTime) { logger.LogWarn("The message with messageid %s expired on %s, method name is %s ", this.getMessageId(), new Date(), logger.getMethodName()); messageExpired = true; } else { messageExpired = false; } } return messageExpired; }
logger.LogInfo("Message with messageid %s along with callback and callbackcontext is added to the queue, method name is %s ", message.getMessageId(), logger.getMethodName());
if (message.getMessageId() != null) sysProperties.put(MESSAGE_ID_KEY, message.getMessageId());
packet = inProgressPackets.remove(message.getMessageId()); "method name is %s ", message.getMessageId(), logger.getMethodName());
separatorNeeded = appendPropertyIfPresent(stringBuilder, separatorNeeded, MESSAGE_ID, message.getMessageId()); separatorNeeded = appendPropertyIfPresent(stringBuilder, separatorNeeded, CORRELATION_ID, message.getCorrelationId()); separatorNeeded = appendPropertyIfPresent(stringBuilder, separatorNeeded, USER_ID, message.getUserId());
if (message.getMessageId() != null) properties.setMessageId(message.getMessageId());
transportMessage = new IotHubTransportMessage(message.getBytes(), message.getMessageType(), message.getMessageId(), message.getCorrelationId(), message.getProperties()); transportMessage.setMessageCallback(this.config.getDeviceTelemetryMessageCallback(message.getInputName())); transportMessage.setMessageCallbackContext(this.config.getDeviceTelemetryMessageContext(message.getInputName()));