@ProviderType public interface OutboundMessageBuilder extends PropertyBasedConfiguration
Warning: the instance of a OutboundMessageBuilder
is NOT thread safe. Changing a
message builder state using with
methods between build
method calls expected to
be executed on a same thread.
This class is a good choice for sequential template-based message creation.
Modifier and Type | Method and Description |
---|---|
OutboundMessage |
build(byte[] payload)
Creates an outbound message using the configuration provided by
this instance of a
message builder and the byte-array payload. |
OutboundMessage |
build(byte[] payload,
Properties extendedMessageProperties)
Creates an outbound message using the configuration provided by
this instance of a
message builder and byte-array payload. |
OutboundMessage |
build(String payload)
Creates an outbound message using configuration provided by
this instance of a message
builder and string payload. |
OutboundMessage |
build(String payload,
Properties extendedMessageProperties)
Creates an outbound message using configuration provided by
this instance of a message
builder and string payload. |
<T extends Serializable> |
build(T payload,
Converter.ObjectToBytes<T> converter)
Creates an outbound message using configuration provided by
this instance of a message
builder and some serializable payload, converter |
<T extends Serializable> |
build(T payload,
Converter.ObjectToBytes<T> converter,
Properties extendedMessageProperties)
Creates an outbound message using configuration provided by
this instance of a message
builder and some serializable payload, converter and extended properties |
OutboundMessageBuilder |
fromProperties(Properties configuration)
Enables property-based configuration.
|
OutboundMessageBuilder |
withApplicationMessageType(String applicationMessageType)
Configures the application message type.
|
OutboundMessageBuilder |
withExpiration(long utcTime)
Configures UTC time (in milliseconds) as Epoch time to indicate when the message is supposed to
expire.
|
OutboundMessageBuilder |
withHTTPContentHeader(String contentType,
String contentEncoding)
Configures HTTP content-type and encoding values for interaction with an HTTP client.
|
OutboundMessageBuilder |
withPriority(int priority)
Configures an optional message optionally priority
|
OutboundMessageBuilder |
withProperty(String key,
String value)
Configures a user-defined property that's sent with a message.
|
OutboundMessageBuilder |
withSenderId(String senderId)
Configures the developer provided sender ID.
|
OutboundMessageBuilder |
withSequenceNumber(long sequenceNumber)
Configures the developer provided message sequence number.
|
OutboundMessageBuilder |
withTimeToLive(long ttl)
Configures the number of milliseconds before the message is discarded or moved to a Dead
Message Queue.
|
OutboundMessage build(byte[] payload)
this
instance of a
message builder and the byte-array payload.payload
- the payload as a byte-arrayOutboundMessage
to be used for publishing
purposesOutboundMessage build(byte[] payload, Properties extendedMessageProperties)
this
instance of a
message builder and byte-array payload.payload
- the payloadextendedMessageProperties
- the extended properties (Key of type String
and Value
of type String
), to customize a particular message
where each key can be customer-provided, or it can be a key
from a SolaceProperties.MessageProperties
objectOutboundMessage
to be used for publishing
purposesOutboundMessage build(String payload)
this
instance of a message
builder and string payload.payload
- the string-based payload for the messageOutboundMessage
to be used for publishing
purposesOutboundMessage build(String payload, Properties extendedMessageProperties)
this
instance of a message
builder and string payload.payload
- the string-based payload for the messageextendedMessageProperties
- the extended properties (Key of type String
and Value
of type String
), to customize a particular message
where each key can be customer-provided, or it can be a key
from a SolaceProperties.MessageProperties
objectOutboundMessage
to be used for publishing
purposes<T extends Serializable> OutboundMessage build(T payload, Converter.ObjectToBytes<T> converter)
this
instance of a message
builder and some serializable payload, converterT
- a serializable business object of type T
payload
- the payload of type T
converter
- the object to bytes converter for the given serializable business object of
type T
OutboundMessage
to be used for publishing
purposes<T extends Serializable> OutboundMessage build(T payload, Converter.ObjectToBytes<T> converter, Properties extendedMessageProperties)
this
instance of a message
builder and some serializable payload, converter and extended propertiesT
- the serializable business object of type T
payload
- payload of type T
converter
- object to bytes converter for the given serializable business
object of type T
extendedMessageProperties
- the extended properties (Key of type String
and Value
of type String
), to customize a particular message
where each key can be customer-provided, or it can be a key
from a SolaceProperties.MessageProperties
objectOutboundMessage
to be used for publishing
purposesOutboundMessageBuilder fromProperties(Properties configuration)
fromProperties
in interface PropertyBasedConfiguration
configuration
- the properties (key of type String
and value of type String
) for configuration and fine-tuning. Common properties can be found
in SolaceProperties
and its sub-interfaces. Refer the SolaceProperties.MessageProperties
for the list of Message
properties configurable
through this OutboundMessageBuilder
IllegalArgumentException
- if invalid properties were specifiedOutboundMessageBuilder withApplicationMessageType(String applicationMessageType)
applicationMessageType
- the application type valueOutboundMessageBuilder
OutboundMessageBuilder withExpiration(long utcTime)
TimeToLive
is set in the same
message. It is carried to clients that receive the message, unmodified and does not affect the
lifecycle of the message.
This property is only valid for persistent messages.
utcTime
- the UTC time (in milliseconds) as Epoch time (from midnight of January 1, 1970
UTC) of when the message expiresOutboundMessageBuilder
OutboundMessageBuilder withHTTPContentHeader(String contentType, String contentEncoding)
contentType
- the MIME content type; the valid values that can be used are defined in
RFC 7231, section-3.1.2.2contentEncoding
- the content encoding; the valid values that can be used are defined in
RFC 2616, section-14.11OutboundMessageBuilder
OutboundMessageBuilder withPriority(int priority)
priority
- a valid priority value range between 0-255 with 0 as the lowest priority and
255 as the highest. A value -1 indicates the priority is not set and a default
priority value is used insteadOutboundMessageBuilder
OutboundMessageBuilder withProperty(String key, String value)
key
- the user-defined keyvalue
- the user-defined valueOutboundMessageBuilder withSenderId(String senderId)
senderId
- the message sender ID value specified by API user. When this value is not set,
API generates internally a value when configured using SolaceProperties.ServiceProperties.GENERATE_SENDER_ID
.OutboundMessageBuilder
OutboundMessageBuilder withSequenceNumber(long sequenceNumber)
sequenceNumber
- the message sequence number value specified by API user, expected to be
set per message. When this value is not set, API generates internally a
value.OutboundMessageBuilder
OutboundMessageBuilder withTimeToLive(long ttl)
A value of 0 means the message never expires. The default value is 0. Value more than 10 years is not permitted.
This property is only valid for persistent messages. It has no effect when used in conjunction with other message types unless the message is promoted by the appliance to a Guaranteed message.
ttl
- The number of milliseconds the persistent message is allowed to live before delivery
to a subscriber.OutboundMessageBuilder
Copyright 2019-2024 Solace Corporation. All rights reserved.