public class Message extends Object
| Modifier and Type | Field and Description |
|---|---|
static Charset |
DEFAULT_IOTHUB_MESSAGE_CHARSET |
| Constructor and Description |
|---|
Message()
Constructor.
|
Message(byte[] body)
Constructor.
|
Message(ByteArrayInputStream stream)
Constructor.
|
Message(String body)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ByteArrayOutputStream |
getBodyStream() |
byte[] |
getBytes()
The byte content of the body.
|
String |
getCorrelationId()
Getter for the correlationId property
|
String |
getMessageId()
Getter for the messageId property
|
MessageProperty[] |
getProperties()
Returns a copy of the message properties.
|
String |
getProperty(String name)
Gets the values of user-defined properties of this Message.
|
boolean |
isExpired()
Verifies whether the message is expired or not
|
void |
setCorrelationId(String correlationId)
Setter for the correlationId property
|
void |
setExpiryTime(long timeOut)
Setter for the expiryTime property
|
void |
setMessageId(String messageId)
Setter for the messageId property
|
void |
setProperty(String name,
String value)
Adds or sets user-defined properties of this Message.
|
public static final Charset DEFAULT_IOTHUB_MESSAGE_CHARSET
public Message()
public Message(ByteArrayInputStream stream)
stream - A stream to provide the body of the new Message instance.public Message(byte[] body)
body - The body of the new Message instance.public Message(String body)
body - The body of the new Message instance. It is internally serialized to a byte array using UTF-8 encoding.public ByteArrayOutputStream getBodyStream()
public byte[] getBytes()
public String getProperty(String name)
name - Name of the user-defined property to search for.public void setProperty(String name, String value)
name - Name of the property to be set.value - Value of the property to be set.IllegalArgumentException - If any of the arguments provided is null.public MessageProperty[] getProperties()
public boolean isExpired()
public String getMessageId()
public void setMessageId(String messageId)
messageId - The string containing the property valuepublic String getCorrelationId()
public void setCorrelationId(String correlationId)
correlationId - The string containing the property valuepublic void setExpiryTime(long timeOut)
timeOut - The time out for the message, in milliseconds.Copyright © 2017. All rights reserved.