Message Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. device. Message
- com.
public class Message
Field Summary
Modifier and Type | Field and Description |
---|---|
final Charset | DEFAULT_IOTHUB_MESSAGE_CHARSET |
Constructor Summary
Constructor | Description |
---|---|
Message() |
Constructor. |
Message(byte[] body) |
Constructor. |
Message(String body) |
Constructor. |
Method Summary
Modifier and Type | Method and Description |
---|---|
ByteArrayOutputStream |
getBodyStream()
The stream content of the body. |
byte [] |
getBytes()
The byte content of the body. |
String | getConnectionDeviceId() |
String | getConnectionModuleId() |
String |
getContentEncoding()
Returns this message's content encoding. This value is null by default |
String |
getContentType()
Return the message's content type. This value is null by default |
Correlating |
getCorrelatingMessageCallback() |
Object | getCorrelatingMessageCallbackContext() |
String |
getCorrelationId()
Getter for the correlationId property |
Date | getCreationTimeUTC() |
String |
getCreationTimeUTCString()
Returns the iot hub accepted format for the creation time utc ex: oct 1st, 2018 yields 2008-10-01T17:04:32.0000000 |
String |
getDeliveryAcknowledgement()
Getter for the delivery acknowledgement system property |
String | getInputName() |
Iot |
getIotHubConnectionString()
Getter for the iotHubConnectionString property |
String |
getMessageId()
Getter for the messageId property |
Message |
getMessageType()
Getter for the Message type |
String | getOutputName() |
Message |
getProperties()
Returns a copy of the message properties. |
String |
getProperty(String name)
Gets the values of user-defined properties of this Message. |
String |
getTo()
Getter for the To system property |
String |
getUserId()
Getter for the User ID system property |
boolean |
isExpired()
Verifies whether the message is expired or not |
boolean | isSecurityMessage() |
void |
setAbsoluteExpiryTime(long absoluteTimeout)
Setter for the expiryTime property using absolute time |
void | setAsSecurityMessage() |
void | setConnectionDeviceId(String connectionDeviceId) |
void | setConnectionModuleId(String connectionModuleId) |
void |
setContentEncoding(String contentEncoding)
Set the content encoding of this message. Used in message routing. |
final void |
setContentType(String contentType)
Set the content type of this message. Used in message routing. |
void | setCorrelatingMessageCallback(CorrelatingMessageCallback correlatingMessageCallback) |
void | setCorrelatingMessageCallbackContext(Object correlatingMessageCallbackContext) |
void |
setCorrelationId(String correlationId)
Setter for the correlationId property |
final void | setCreationTimeUTC(Date creationTimeUTC) |
void |
setExpiryTime(long timeOut)
Setter for the expiryTime property. This setter uses relative time, not absolute time. |
void |
setInputName(String inputName)
Set the input name of the message, used in routing for module communications |
void |
setIotHubConnectionString(IotHubConnectionString iotHubConnectionString)
Setter for the iotHubConnectionString type |
void |
setMessageId(String messageId)
Setter for the messageId property |
void |
setMessageType(MessageType type)
Setter for the Message type |
void |
setOutputName(String outputName)
Set the output channel name to send to. Used in routing for module communications |
void |
setProperty(String name, String value)
Adds or sets user-defined properties of this Message. |
void | setUserId(String userId) |
String | toString() |
Field Details
DEFAULT_IOTHUB_MESSAGE_CHARSET
public static final Charset DEFAULT_IOTHUB_MESSAGE_CHARSET= StandardCharsets.UTF_8
Constructor Details
Message
public Message()
Constructor.
Message
public Message(byte[] body)
Constructor.
Parameters:
Message
public Message(String body)
Constructor.
Parameters:
Method Details
getBodyStream
public ByteArrayOutputStream getBodyStream()
The stream content of the body.
Returns:
getBytes
public byte [] getBytes()
The byte content of the body.
Returns:
getConnectionDeviceId
public String getConnectionDeviceId()
getConnectionModuleId
public String getConnectionModuleId()
getContentEncoding
public String getContentEncoding()
Returns this message's content encoding. This value is null by default
Returns:
getContentType
public String getContentType()
Return the message's content type. This value is null by default
Returns:
getCorrelatingMessageCallback
public CorrelatingMessageCallback getCorrelatingMessageCallback()
getCorrelatingMessageCallbackContext
public Object getCorrelatingMessageCallbackContext()
getCorrelationId
public String getCorrelationId()
Getter for the correlationId property
Returns:
getCreationTimeUTC
public Date getCreationTimeUTC()
getCreationTimeUTCString
public String getCreationTimeUTCString()
Returns the iot hub accepted format for the creation time utc
ex: oct 1st, 2018 yields 2008-10-01T17:04:32.0000000
Returns:
getDeliveryAcknowledgement
public String getDeliveryAcknowledgement()
Getter for the delivery acknowledgement system property
Returns:
getInputName
public String getInputName()
getIotHubConnectionString
public IotHubConnectionString getIotHubConnectionString()
Getter for the iotHubConnectionString property
Returns:
getMessageId
public String getMessageId()
Getter for the messageId property
Returns:
getMessageType
public MessageType getMessageType()
Getter for the Message type
Returns:
getOutputName
public String getOutputName()
getProperties
public MessageProperty [] getProperties()
Returns a copy of the message properties.
Returns:
getProperty
public String getProperty(String name)
Gets the values of user-defined properties of this Message.
Parameters:
Returns:
getTo
public String getTo()
Getter for the To system property
Returns:
getUserId
public String getUserId()
Getter for the User ID system property
Returns:
isExpired
public boolean isExpired()
Verifies whether the message is expired or not
Returns:
isSecurityMessage
public boolean isSecurityMessage()
setAbsoluteExpiryTime
public void setAbsoluteExpiryTime(long absoluteTimeout)
Setter for the expiryTime property using absolute time
Parameters:
setAsSecurityMessage
public void setAsSecurityMessage()
setConnectionDeviceId
public void setConnectionDeviceId(String connectionDeviceId)
Parameters:
setConnectionModuleId
public void setConnectionModuleId(String connectionModuleId)
Parameters:
setContentEncoding
public void setContentEncoding(String contentEncoding)
Set the content encoding of this message. Used in message routing.
Parameters:
setContentType
public final void setContentType(String contentType)
Set the content type of this message. Used in message routing.
Parameters:
setCorrelatingMessageCallback
public void setCorrelatingMessageCallback(CorrelatingMessageCallback correlatingMessageCallback)
Parameters:
setCorrelatingMessageCallbackContext
public void setCorrelatingMessageCallbackContext(Object correlatingMessageCallbackContext)
Parameters:
setCorrelationId
public void setCorrelationId(String correlationId)
Setter for the correlationId property
Parameters:
setCreationTimeUTC
public final void setCreationTimeUTC(Date creationTimeUTC)
Parameters:
setExpiryTime
public void setExpiryTime(long timeOut)
Setter for the expiryTime property. This setter uses relative time, not absolute time.
Parameters:
setInputName
public void setInputName(String inputName)
Set the input name of the message, used in routing for module communications
Parameters:
setIotHubConnectionString
public void setIotHubConnectionString(IotHubConnectionString iotHubConnectionString)
Setter for the iotHubConnectionString type
Parameters:
setMessageId
public void setMessageId(String messageId)
Setter for the messageId property
Parameters:
setMessageType
public void setMessageType(MessageType type)
Setter for the Message type
Parameters:
setOutputName
public void setOutputName(String outputName)
Set the output channel name to send to. Used in routing for module communications
Parameters:
setProperty
public void setProperty(String name, String value)
Adds or sets user-defined properties of this Message.
Parameters:
Throws:
setUserId
public void setUserId(String userId)
Parameters:
toString
public String toString()
Applies to
Azure SDK for Java