Freigeben über


Message Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.Message

public class Message

IotHub specific message container

Field Summary

Modifier and Type Field and Description
java.lang.String correlationId

Used in message responses and feedback

Constructor Summary

Constructor 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)

Method Summary

Modifier and Type Method and Description
void clearCustomProperties()
java.io.ByteArrayOutputStream getBodyStream()

The stream content of the body.

byte[] getBytes()

The byte content of the body.

java.lang.String getCorrelationId()
DeliveryAcknowledgement getDeliveryAcknowledgement()
java.util.Date getExpiryTimeUtc()
java.lang.String getLockToken()
java.lang.String getMessageId()
java.util.Map<java.lang.String,java.lang.String> getProperties()
java.lang.String getTo()
java.lang.String getUserId()
void setCorrelationId(String correlationId)
void setDeliveryAcknowledgement(DeliveryAcknowledgement deliveryAcknowledgement)

Deprecated

final 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)

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Field Details

correlationId

public String correlationId

Used in message responses and feedback

Constructor Details

Message

public Message()

Basic constructor

Message

public Message(byte[] byteArray)

byteArray: a byte array containing the body of the message

Parameters:

byteArray - The byte array containing the message body

Message

public Message(ByteArrayInputStream stream)

stream: a stream containing the body of the message

Parameters:

stream - The stream containing the message body

Message

public Message(String string)

Parameters:

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.

Throws:

java.io.UnsupportedEncodingException - This exception is thrown if unsupported encoding used

Method Details

clearCustomProperties

public void clearCustomProperties()

getBodyStream

public ByteArrayOutputStream getBodyStream()

The stream content of the body.

Returns:

The ByteArrayOutputStream object containing the message body

getBytes

public byte[] getBytes()

The byte content of the body.

Returns:

The byte array of the message body

getCorrelationId

public String getCorrelationId()

getDeliveryAcknowledgement

public DeliveryAcknowledgement getDeliveryAcknowledgement()

getExpiryTimeUtc

public Date getExpiryTimeUtc()

getLockToken

public String getLockToken()

getMessageId

public String getMessageId()

getProperties

public Map getProperties()

getTo

public String getTo()

getUserId

public String getUserId()

setCorrelationId

public void setCorrelationId(String correlationId)

Parameters:

correlationId

setDeliveryAcknowledgement


public void setDeliveryAcknowledgement(DeliveryAcknowledgement deliveryAcknowledgement)

Deprecated

Parameters:

deliveryAcknowledgement - the delivery acknowledgement to set

setDeliveryAcknowledgementFinal

public final void setDeliveryAcknowledgementFinal(DeliveryAcknowledgement deliveryAcknowledgement)

Parameters:

deliveryAcknowledgement - the delivery acknowledgement to set

setExpiryTimeUtc

public void setExpiryTimeUtc(Date expiryTimeUtc)

Parameters:

expiryTimeUtc

setMessageId

public void setMessageId(String messageId)

Parameters:

messageId

setProperties

public void setProperties(Map properties)

Parameters:

properties

setTo

public void setTo(String deviceId)

Parameters:

deviceId

setUserId

public void setUserId(String userId)

Parameters:

userId

Applies to