/** * Constructor. * @param body The body of the new Message instance. It is internally serialized to a byte array using UTF-8 encoding. */ public IotHubTransportMessage(String body) { // Codes_SRS_IOTHUBTRANSPORTMESSAGE_21_002: [This method shall throw IllegalArgumentException if the body argument is null.] super(body); super.setMessageType(MessageType.UNKNOWN); this.methodName = null; this.version = null; this.requestId = null; this.status = null; this.operationType = DeviceOperations.DEVICE_OPERATION_UNKNOWN; }
super.setMessageType(messageType); this.methodName = null; this.version = null;
public IotHubTransportMessage(byte[] data, MessageType messageType, String messageId, String correlationId, MessageProperty[] messageProperties) { //Codes_SRS_IOTHUBTRANSPORTMESSAGE_34_017: [This constructor shall return an instance of IotHubTransportMessage with provided bytes, messagetype, correlationid, messageid, and application properties.] super(data); super.setMessageType(messageType); this.setMessageId(messageId); this.setCorrelationId(correlationId); for (MessageProperty messageProperty : messageProperties) { this.setProperty(messageProperty.getName(), messageProperty.getValue()); } }
msg.setMessageId(java.util.UUID.randomUUID().toString()); msg.setExpiryTime(D2C_MESSAGE_TIMEOUT); msg.setMessageType(MessageType.DEVICE_TELEMETRY);