public class Message
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.nio.charset.Charset |
DEFAULT_IOTHUB_MESSAGE_CHARSET |
| Constructor and Description |
|---|
Message()
Constructor.
|
Message(byte[] body)
Constructor.
|
Message(java.lang.String body)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.ByteArrayOutputStream |
getBodyStream()
The stream content of the body.
|
byte[] |
getBytes()
The byte content of the body.
|
java.lang.String |
getConnectionDeviceId() |
java.lang.String |
getConnectionModuleId() |
java.lang.String |
getContentEncoding()
Returns this message's content encoding.
|
java.lang.String |
getContentType()
Return the message's content type.
|
CorrelatingMessageCallback |
getCorrelatingMessageCallback() |
java.lang.Object |
getCorrelatingMessageCallbackContext() |
java.lang.String |
getCorrelationId()
Getter for the correlationId property
|
java.util.Date |
getCreationTimeUTC() |
java.lang.String |
getCreationTimeUTCString()
Returns the iot hub accepted format for the creation time utc
ex:
oct 1st, 2018 yields
2008-10-01T17:04:32.0000000
|
java.lang.String |
getDeliveryAcknowledgement()
Getter for the delivery acknowledgement system property
|
java.lang.String |
getInputName() |
IotHubConnectionString |
getIotHubConnectionString()
Getter for the iotHubConnectionString property
|
java.lang.String |
getMessageId()
Getter for the messageId property
|
MessageType |
getMessageType()
Getter for the Message type
|
java.lang.String |
getOutputName() |
MessageProperty[] |
getProperties()
Returns a copy of the message properties.
|
java.lang.String |
getProperty(java.lang.String name)
Gets the values of user-defined properties of this Message.
|
java.lang.String |
getTo()
Getter for the To system property
|
java.lang.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(java.lang.String connectionDeviceId) |
void |
setConnectionModuleId(java.lang.String connectionModuleId) |
void |
setContentEncoding(java.lang.String contentEncoding)
Set the content encoding of this message.
|
void |
setContentType(java.lang.String contentType)
Set the content type of this message.
|
void |
setCorrelatingMessageCallback(CorrelatingMessageCallback correlatingMessageCallback) |
void |
setCorrelatingMessageCallbackContext(java.lang.Object correlatingMessageCallbackContext) |
void |
setCorrelationId(java.lang.String correlationId)
Setter for the correlationId property
|
void |
setCreationTimeUTC(java.util.Date creationTimeUTC) |
void |
setExpiryTime(long timeOut)
Setter for the expiryTime property.
|
void |
setInputName(java.lang.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(java.lang.String messageId)
Setter for the messageId property
|
void |
setMessageType(MessageType type)
Setter for the Message type
|
void |
setOutputName(java.lang.String outputName)
Set the output channel name to send to.
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Adds or sets user-defined properties of this Message.
|
void |
setUserId(java.lang.String userId) |
java.lang.String |
toString() |
public static final java.nio.charset.Charset DEFAULT_IOTHUB_MESSAGE_CHARSET
public Message()
public Message(byte[] body)
body - The body of the new Message instance.public Message(java.lang.String body)
body - The body of the new Message instance. It is internally serialized to a byte array using UTF-8 encoding.public java.io.ByteArrayOutputStream getBodyStream()
public byte[] getBytes()
public java.lang.String getProperty(java.lang.String name)
name - Name of the user-defined property to search for.public void setProperty(java.lang.String name,
java.lang.String value)
name - Name of the property to be set.value - Value of the property to be set.java.lang.IllegalArgumentException - If any of the arguments provided is null.public MessageProperty[] getProperties()
public boolean isExpired()
public java.lang.String getMessageId()
public void setMessageId(java.lang.String messageId)
messageId - The string containing the property valuepublic void setUserId(java.lang.String userId)
public java.lang.String getCorrelationId()
public void setCorrelationId(java.lang.String correlationId)
correlationId - The string containing the property valuepublic void setExpiryTime(long timeOut)
timeOut - The time out for the message, in milliseconds, from the current time.public void setAbsoluteExpiryTime(long absoluteTimeout)
absoluteTimeout - The time out for the message, in milliseconds.public MessageType getMessageType()
public void setConnectionDeviceId(java.lang.String connectionDeviceId)
public void setConnectionModuleId(java.lang.String connectionModuleId)
public void setOutputName(java.lang.String outputName)
outputName - the output channel name to send topublic void setInputName(java.lang.String inputName)
inputName - the input channel the message was received frompublic void setMessageType(MessageType type)
type - The enum containing the Message type valuepublic java.lang.String getTo()
public java.lang.String getConnectionDeviceId()
public java.lang.String getConnectionModuleId()
public java.lang.String getInputName()
public java.lang.String getOutputName()
public java.lang.String getDeliveryAcknowledgement()
public java.lang.String getUserId()
public IotHubConnectionString getIotHubConnectionString()
public void setIotHubConnectionString(IotHubConnectionString iotHubConnectionString)
iotHubConnectionString - The iotHubConnectionString value to setpublic java.lang.String getContentType()
public final void setContentType(java.lang.String contentType)
contentType - the content type of the message. May be null if you don't want to specify a content type.public java.lang.String getContentEncoding()
public void setContentEncoding(java.lang.String contentEncoding)
contentEncoding - the content encoding of the message. May be null if you don't want to specify a content encoding.public java.util.Date getCreationTimeUTC()
public java.lang.String getCreationTimeUTCString()
public final void setCreationTimeUTC(java.util.Date creationTimeUTC)
public void setAsSecurityMessage()
public boolean isSecurityMessage()
public java.lang.String toString()
toString in class java.lang.Objectpublic void setCorrelatingMessageCallback(CorrelatingMessageCallback correlatingMessageCallback)
public CorrelatingMessageCallback getCorrelatingMessageCallback()
public void setCorrelatingMessageCallbackContext(java.lang.Object correlatingMessageCallbackContext)
public java.lang.Object getCorrelatingMessageCallbackContext()
Copyright © 2023. All rights reserved.