Package org.springframework.amqp.core
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
- See Also:
-
Constructor Summary
ConstructorDescriptionMessage
(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 TypeMethodDescriptionstatic void
addAllowedListPatterns
(String... patterns) Deprecated.toString() no longer deserializes the body.boolean
byte[]
getBody()
int
hashCode()
static void
setDefaultEncoding
(String encoding) Set the encoding to use intoString()
when converting the body if there is nocontentEncoding
message property present.static void
setMaxBodyLength
(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
-
addAllowedListPatterns
Deprecated.toString() no longer deserializes the body.No longer used.- Parameters:
patterns
- the patterns.- Since:
- 1.5.7
-
setDefaultEncoding
Set the encoding to use intoString()
when converting the body if there is nocontentEncoding
message 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
public int hashCode() -
equals
-