public class Message extends Object
| Modifier and Type | Field and Description |
|---|---|
String |
correlationId
Used in message responses and feedback
|
| Constructor and Description |
|---|
Message()
Basic constructor
|
Message(byte[] byteArray)
byteArray: a byte array containing the body of the message
|
Message(ByteArrayInputStream stream)
stream: a stream containing the body of the message
|
Message(String string) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCustomProperties() |
ByteArrayOutputStream |
getBodyStream()
The stream content of the body.
|
byte[] |
getBytes()
The byte content of the body.
|
String |
getCorrelationId() |
DeliveryAcknowledgement |
getDeliveryAcknowledgement() |
Date |
getExpiryTimeUtc() |
String |
getLockToken() |
String |
getMessageId() |
Map<String,String> |
getProperties() |
String |
getTo() |
String |
getUserId() |
void |
setCorrelationId(String correlationId) |
void |
setDeliveryAcknowledgement(DeliveryAcknowledgement deliveryAcknowledgement)
Deprecated.
as of service-client version 1.15.1, please use
setDeliveryAcknowledgementFinal(DeliveryAcknowledgement) |
void |
setDeliveryAcknowledgementFinal(DeliveryAcknowledgement deliveryAcknowledgement) |
void |
setExpiryTimeUtc(Date expiryTimeUtc) |
void |
setMessageId(String messageId) |
void |
setProperties(Map<String,String> properties) |
void |
setTo(String deviceId) |
void |
setUserId(String userId) |
public String correlationId
public Message()
public Message(ByteArrayInputStream stream)
stream - The stream containing the message bodypublic Message(byte[] byteArray)
byteArray - The byte array containing the message bodypublic Message(String string) throws UnsupportedEncodingException
string - - 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.UnsupportedEncodingException - This exception is thrown if unsupported encoding usedpublic String getMessageId()
public void setMessageId(String messageId)
public String getTo()
public void setTo(String deviceId)
public Date getExpiryTimeUtc()
public void setExpiryTimeUtc(Date expiryTimeUtc)
public String getLockToken()
public String getCorrelationId()
public void setCorrelationId(String correlationId)
public String getUserId()
public void setUserId(String userId)
public ByteArrayOutputStream getBodyStream()
public byte[] getBytes()
public DeliveryAcknowledgement getDeliveryAcknowledgement()
@Deprecated public void setDeliveryAcknowledgement(DeliveryAcknowledgement deliveryAcknowledgement)
setDeliveryAcknowledgementFinal(DeliveryAcknowledgement)deliveryAcknowledgement - the delivery acknowledgement to setpublic final void setDeliveryAcknowledgementFinal(DeliveryAcknowledgement deliveryAcknowledgement)
deliveryAcknowledgement - the delivery acknowledgement to setpublic void clearCustomProperties()
Copyright © 2022. All rights reserved.