Package org.springframework.amqp.core
Class MessageBuilder
java.lang.Object
org.springframework.amqp.core.MessageBuilderSupport<Message>
org.springframework.amqp.core.MessageBuilder
Builds a Spring AMQP Message either from a byte[] body or
another Message using a fluent API.
- Since:
- 1.3
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionandProperties
(MessageProperties properties) Makes this builder's properties builder use a reference to properties.build()
static MessageBuilder
fromClonedMessage
(Message message) The final message will have a copy of the message body, the MessageProperties will be cloned (top level only).static MessageBuilder
fromMessage
(Message message) The final message body will be a direct reference to the message body, the MessageProperties will be a shallow copy.static MessageBuilder
withBody
(byte[] body) The final message body will be a direct reference to 'body'.static MessageBuilder
withBody
(byte[] body, int from, int to) The final message body will be a new array containing the byte range from 'body'.static MessageBuilder
withClonedBody
(byte[] body) The final message body will be a copy of 'body' in a new array.Methods inherited from class org.springframework.amqp.core.MessageBuilderSupport
buildProperties, copyHeaders, copyHeadersIfAbsent, copyProperties, removeHeader, removeHeaders, setAppId, setAppIdIfAbsent, setClusterId, setClusterIdIfAbsent, setContentEncoding, setContentEncodingIfAbsent, setContentLength, setContentLengthIfAbsent, setContentType, setContentTypeIfAbsentOrDefault, setCorrelationId, setCorrelationIdIfAbsent, setDeliveryMode, setDeliveryModeIfAbsentOrDefault, setDeliveryTag, setDeliveryTagIfAbsent, setExpiration, setExpirationIfAbsent, setHeader, setHeaderIfAbsent, setMessageCount, setMessageCountIfAbsent, setMessageId, setMessageIdIfAbsent, setPriority, setPriorityIfAbsentOrDefault, setProperties, setReceivedExchange, setReceivedExchangeIfAbsent, setReceivedRoutingKey, setReceivedRoutingKeyIfAbsent, setRedelivered, setRedeliveredIfAbsent, setReplyTo, setReplyToAddress, setReplyToAddressIfAbsent, setReplyToIfAbsent, setTimestamp, setTimestampIfAbsent, setType, setTypeIfAbsent, setUserId, setUserIdIfAbsent
-
Method Details
-
withBody
The final message body will be a direct reference to 'body'.- Parameters:
body
- The body.- Returns:
- The builder.
-
withClonedBody
The final message body will be a copy of 'body' in a new array.- Parameters:
body
- The body.- Returns:
- The builder.
-
withBody
The final message body will be a new array containing the byte range from 'body'.- Parameters:
body
- The body.from
- The starting index.to
- The ending index.- Returns:
- The builder.
- See Also:
-
fromMessage
The final message body will be a direct reference to the message body, the MessageProperties will be a shallow copy.- Parameters:
message
- The message.- Returns:
- The builder.
-
fromClonedMessage
The final message will have a copy of the message body, the MessageProperties will be cloned (top level only).- Parameters:
message
- The message.- Returns:
- The builder.
-
andProperties
Makes this builder's properties builder use a reference to properties.- Parameters:
properties
- The properties.- Returns:
- this.
-
build
- Specified by:
build
in classMessageBuilderSupport<Message>
-