Package org.springframework.amqp.core
Class Message
- java.lang.Object
-
- org.springframework.amqp.core.Message
-
- All Implemented Interfaces:
java.io.Serializable
public class Message extends java.lang.Object implements java.io.SerializableThe 0-8 and 0-9-1 AMQP specifications do not define an Message class or interface. Instead, when performing an operation such as basicPublish the content is passed as a byte-array argument and additional properties are passed in as separate arguments. Spring AMQP defines a Message class as part of a more general AMQP domain model representation. The purpose of the Message class is to simply encapsulate the body and properties within a single instance so that the rest of the AMQP API can in turn be simpler.- Author:
- Mark Pollack, Mark Fisher, Oleg Zhurakousky, Dave Syer, Gary Russell, Alex Panchenko, Artem Bilan
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Message(byte[] body)Construct an instance with the provided body and defaultMessageProperties.Message(byte[] body, MessageProperties messageProperties)Construct an instance with the provided body and properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidaddAllowedListPatterns(java.lang.String... patterns)Deprecated.toString() no longer deserializes the body.booleanequals(java.lang.Object obj)byte[]getBody()MessagePropertiesgetMessageProperties()inthashCode()static voidsetDefaultEncoding(java.lang.String encoding)Set the encoding to use intoString()when converting the body if there is nocontentEncodingmessage property present.static voidsetMaxBodyLength(int length)Set the maximum length of a test message body to render as a String intoString().java.lang.StringtoString()
-
-
-
Constructor Detail
-
Message
public Message(byte[] body)
Construct an instance with the provided body and defaultMessageProperties.- Parameters:
body- the body.- Since:
- 2.2.17
-
Message
public Message(byte[] body, MessageProperties messageProperties)Construct an instance with the provided body and properties.- Parameters:
body- the body.messageProperties- the properties.
-
-
Method Detail
-
addAllowedListPatterns
@Deprecated public static void addAllowedListPatterns(java.lang.String... patterns)
Deprecated.toString() no longer deserializes the body.No longer used.- Parameters:
patterns- the patterns.- Since:
- 1.5.7
-
setDefaultEncoding
public static void setDefaultEncoding(java.lang.String encoding)
Set the encoding to use intoString()when converting the body if there is nocontentEncodingmessage property present.- Parameters:
encoding- the encoding to use.- Since:
- 2.2.4
-
setMaxBodyLength
public static void setMaxBodyLength(int length)
Set the maximum length of a test message body to render as a String intoString(). Default 50.- Parameters:
length- the length to render.- Since:
- 2.2.20
-
getBody
public byte[] getBody()
-
getMessageProperties
public MessageProperties getMessageProperties()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-