MessageBody Class
- java.
lang. Object - Serializable
- com.
microsoft. azure. servicebus. MessageBody
- com.
public class MessageBody
This class encapsulates the body of a message. Body types map to AMQP message body types. It has getters and setters for multiple body types. Client should test for body type before calling corresponding get method. Get methods not corresponding to the type of the body return null.
Method Summary
Modifier and Type | Method and Description |
---|---|
Message |
fromBinaryData(List<byte[]> binaryData)
Creates a message body from a list of Data sections.Each Data section is a byte array. Please note that this version of the SDK supports only one Data section in a message. It means only a list of exactly one byte array in it is accepted as message body. |
Message |
fromSequenceData(List<List<Object>> sequenceData)
Creates a message body from a list of AMQPSequence sections.Each AMQPSequence section is in turn a list of objects. Please note that this version of the SDK supports only one AMQPSequence section in a message. It means only a list of exactly one sequence in it is accepted as message body. |
Message |
fromValueData(Object value)
Creates message body of AMQPValue type. |
List<byte[]> |
getBinaryData()
Returns the content of message body. |
Message |
getBodyType()
Return the type of content in this message body. |
List<List<Object>> |
getSequenceData()
Returns the content of message body. |
Object |
getValueData()
Returns the content of message body. |
Method Details
fromBinaryData
public static MessageBody fromBinaryData(List
Creates a message body from a list of Data sections.Each Data section is a byte array. Please note that this version of the SDK supports only one Data section in a message. It means only a list of exactly one byte array in it is accepted as message body.
Parameters:
Returns:
fromSequenceData
public static MessageBody fromSequenceData(List> sequenceData)
Creates a message body from a list of AMQPSequence sections.Each AMQPSequence section is in turn a list of objects. Please note that this version of the SDK supports only one AMQPSequence section in a message. It means only a list of exactly one sequence in it is accepted as message body.
Parameters:
Returns:
fromValueData
public static MessageBody fromValueData(Object value)
Creates message body of AMQPValue type.
Parameters:
Returns:
getBinaryData
public List
Returns the content of message body.
Returns:
getBodyType
public MessageBodyType getBodyType()
Return the type of content in this message body.
Returns:
getSequenceData
public List> getSequenceData()
Returns the content of message body.
Returns:
getValueData
public Object getValueData()
Returns the content of message body.
Returns:
Applies to
Azure SDK for Java