Message Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. device. Message
- com.
public class Message
Field Summary
Modifier and Type | Field and Description |
---|---|
static final java.nio.charset.Charset | DEFAULT_IOTHUB_MESSAGE_CHARSET |
Constructor Summary
Constructor | Description |
---|---|
Message() |
Constructor. |
Message(byte[] body) |
Constructor. |
Message(ByteArrayInputStream stream) |
Constructor. |
Message(String body) |
Constructor. |
Method Summary
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. |
Correlating |
getCorrelatingMessageCallback() |
java.lang.Object | getCorrelatingMessageCallbackContext() |
java.lang.String |
getCorrelationId()
Getter for the correlation |
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() |
Iot |
getIotHubConnectionString()
Getter for the iot |
java.lang.String |
getMessageId()
Getter for the message |
Message |
getMessageType()
Getter for the Message type |
java.lang.String | getOutputName() |
Message |
getProperties()
Returns a copy of the message properties. |
java.lang.String |
getProperty(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 expiry |
void | setAsSecurityMessage() |
void | setConnectionDeviceId(String connectionDeviceId) |
void | setConnectionModuleId(String connectionModuleId) |
void |
setContentEncoding(String contentEncoding)
Set the content encoding of this message. |
void |
setContentType(String contentType)
Deprecated
as of device-client version 1.14.1, please use setContentTypeFinal(String contentType)
Set the content type of this message. |
final void |
setContentTypeFinal(String contentType)
Set the content type of this message. |
void | setCorrelatingMessageCallback(CorrelatingMessageCallback correlatingMessageCallback) |
void | setCorrelatingMessageCallbackContext(Object correlatingMessageCallbackContext) |
void |
setCorrelationId(String correlationId)
Setter for the correlation |
final void | setCreationTimeUTC(Date creationTimeUTC) |
void |
setExpiryTime(long timeOut)
Setter for the expiry |
void |
setInputName(String inputName)
Set the input name of the message, used in routing for module communications |
void |
setIotHubConnectionString(IotHubConnectionString iotHubConnectionString)
Setter for the iot |
void |
setMessageId(String messageId)
Setter for the message |
void |
setMessageType(MessageType type)
Setter for the Message type |
void |
setOutputName(String outputName)
Set the output channel name to send to. |
void |
setProperty(String name, String value)
Adds or sets user-defined properties of this Message. |
void | setUserId(String userId) |
java.lang.String | toString() |
Methods inherited from java.lang.Object
Field Details
DEFAULT_IOTHUB_MESSAGE_CHARSET
public static final Charset DEFAULT_IOTHUB_MESSAGE_CHARSET
Constructor Details
Message
public Message()
Constructor.
Message
public Message(byte[] body)
Constructor.
Parameters:
Message
public Message(ByteArrayInputStream stream)
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 void setContentType(String contentType)
Deprecated
Set the content type of this message. Used in message routing.
Parameters:
setContentTypeFinal
public final void setContentTypeFinal(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:
setUserId
public void setUserId(String userId)
Parameters:
toString
public String toString()
Overrides:
Message.toString()Applies to
Azure SDK for Java
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour