你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Message Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. Message
- com.
public class Message
IotHub specific message container
Field Summary
Modifier and Type | Field and Description |
---|---|
java.lang.String |
correlationId
Used in message responses and feedback |
Constructor Summary
Constructor | Description | |
---|---|---|
Message() |
Basic constructor |
|
Message(byte[] byteArray) |
byte |
|
Message(ByteArrayInputStream stream) |
stream: a stream containing the body of the message |
|
Message(String string) |
Method Summary
Methods inherited from java.lang.Object
Field Details
correlationId
public String correlationId
Used in message responses and feedback
Constructor Details
Message
public Message()
Basic constructor
Message
public Message(byte[] byteArray)
byteArray: a byte array containing the body of the message
Parameters:
Message
public Message(ByteArrayInputStream stream)
stream: a stream containing the body of the message
Parameters:
Message
public Message(String string)
Parameters:
- a string containing the body of the message. Important: If a string is passed, the HttpBatch.SerializeAsString is set to true, and the internal byte representation is serialized as UTF-8, with HttpBatch.Encoding set to UTF-8.
Throws:
Method Details
clearCustomProperties
public void clearCustomProperties()
getBodyStream
public ByteArrayOutputStream getBodyStream()
The stream content of the body.
Returns:
getBytes
public byte[] getBytes()
The byte content of the body.
Returns:
getCorrelationId
public String getCorrelationId()
getDeliveryAcknowledgement
public DeliveryAcknowledgement getDeliveryAcknowledgement()
getExpiryTimeUtc
public Date getExpiryTimeUtc()
getLockToken
public String getLockToken()
getMessageId
public String getMessageId()
getProperties
public Map
getTo
public String getTo()
getUserId
public String getUserId()
setCorrelationId
public void setCorrelationId(String correlationId)
Parameters:
setDeliveryAcknowledgement
public void setDeliveryAcknowledgement(DeliveryAcknowledgement deliveryAcknowledgement)
Deprecated
Parameters:
setDeliveryAcknowledgementFinal
public final void setDeliveryAcknowledgementFinal(DeliveryAcknowledgement deliveryAcknowledgement)
Parameters:
setExpiryTimeUtc
public void setExpiryTimeUtc(Date expiryTimeUtc)
Parameters:
setMessageId
public void setMessageId(String messageId)
Parameters:
setProperties
public void setProperties(Map
Parameters:
setTo
public void setTo(String deviceId)
Parameters:
setUserId
public void setUserId(String userId)
Parameters: