Class Message
java.lang.Object
org.springframework.amqp.core.Message
- All Implemented Interfaces:
Serializable
The 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, Ngoc Nhan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMessage(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
Modifier and TypeMethodDescriptionbooleanbyte[]getBody()inthashCode()static voidsetDefaultEncoding(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().toString()
-
Constructor Details
-
Message
public Message(byte[] body) Construct an instance with the provided body and defaultMessageProperties.- Parameters:
body- the body.- Since:
- 2.2.17
-
Message
Construct an instance with the provided body and properties.- Parameters:
body- the body.messageProperties- the properties.
-
-
Method Details
-
setDefaultEncoding
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
-
toString
-
hashCode
-
equals
-