Version: 10.17.1
Class

solace.Message

Contents

class solace.Message extends solace.MessageTracingSupport

This class is not exposed for construction by API users. Users should obtain an instance from solace.SolclientFactory.createMessage

A message is a container that can be used to store and send messages to and from the Solace Message Router.

Applications manage the lifecycle of a message; a message is created by calling solace.SolclientFactory.createMessage and is freed by dereferencing it.

API operations that cache or mutate messages always take a copy. A message may be created, mutated by the API user, and sent multiple times.

The Message Object provides methods to manipulate the common Solace message header fields that are optionally sent in the binary metadata portion of the Solace message.

Applications can also use the structured data API solace.Message#setSdtContainer to add containers (maps or streams) and their fields to the binary payload or to the User Property map contained within the binary metadata.

This does not prevent applications from ignoring these methods and sending payload in the binary payload as an opaque binary field for end-to-end communications

Constructor Top

  Message ( )

Static Properties & Enumerations Top

SOLCLIENT_USER_PROP_QUEUE_PARTITION_KEY

Properties Top

readonly Boolean isAcknowledged
readonly Boolean isSettled

Methods Top

void acknowledge ( )
String dump ( Number flags )
String getApplicationMessageId ( )
String getApplicationMessageType ( )
solace.Baggage getBaggage ( )
Uint8Array | String | null getBinaryAttachment ( )
Number getCacheRequestId ( )
solace.MessageCacheStatus getCacheStatus ( )
String getCorrelationId ( )
Object getCorrelationKey ( )
solace.TraceContext getCreationContext ( )
Number | undefined getDeliveryCount ( )
solace.MessageDeliveryModeType getDeliveryMode ( )
Destination getDestination ( )
Number | undefined getGMExpiration ( )
Long getGuaranteedMessageId ( )
String getHttpContentEncoding ( )
String getHttpContentType ( )
solace.MessageConsumer getMessageConsumer ( )
Number getPriority ( )
Number getReceiverTimestamp ( )
solace.ReplicationGroupMessageId getReplicationGroupMessageId ( )
solace.Destination getReplyTo ( )
SDTField | null getSdtContainer ( )
String getSenderId ( )
Number getSenderTimestamp ( )
Number getSequenceNumber ( )
Number getSequenceNumber ( )
Number getTimeToLive ( )
Long getTopicSequenceNumber ( )
solace.TraceContextSetter getTraceContextSetter ( )
solace.TraceContext getTransportContext ( )
solace.MessageType getType ( )
solace.MessageUserCosType getUserCos ( )
String getUserData ( )
solace.SDTMapContainer getUserPropertyMap ( )
String getXmlContent ( )
String getXmlContentDecoded ( )
String getXmlMetadata ( )
Boolean isAcknowledgeImmediately ( )
Boolean isDeliverToOne ( )
Boolean isDiscardIndication ( )
Boolean isDMQEligible ( )
Boolean isElidingEligible ( )
Boolean isRedelivered ( )
Boolean isReplyMessage ( )
void reset ( )
void setAcknowledgeImmediately ( Boolean value )
void setApplicationMessageId ( String value )
void setApplicationMessageType ( String value )
void setAsReplyMessage ( Boolean value )
void setBinaryAttachment ( Uint8Array | ArrayBufferLike | DataView | String | null | undefined value )
void setCorrelationId ( String | null | undefined value )
void setCorrelationKey ( Object | String | null | undefined value )
void setDeliverToOne ( Boolean value )
void setDeliveryMode ( solace.MessageDeliveryModeType value )
void setDestination ( Destination value )
void setDMQEligible ( Boolean value )
void setElidingEligible ( Boolean value )
void setGMExpiration ( Number value )
void setHttpContentEncoding ( String value )
void setHttpContentType ( String value )
void setPriority ( Number value )
void setReplyTo ( solace.Destination value )
void setSdtContainer ( solace.SDTField container )
void setSenderId ( String value )
void setSenderTimestamp ( Number value )
void setSequenceNumber ( Number value )
void setTimeToLive ( Number value )
void settle ( solace.MessageOutcome messageSettlementOutcome )
void setTransportContext ( solace.TraceContextSetter contextSetter )
void setUserCos ( solace.MessageUserCosType value )
void setUserData ( String value )
void setUserPropertyMap ( SDTMapContainer value )
void setXmlContent ( String value )
void setXmlMetadata ( String value )

Constructor details Top

Message ( )

This class is not exposed for construction by API users. Users should obtain an instance from solace.SolclientFactory.createMessage

A message is a container that can be used to store and send messages to and from the Solace Message Router.

Applications manage the lifecycle of a message; a message is created by calling solace.SolclientFactory.createMessage and is freed by dereferencing it.

API operations that cache or mutate messages always take a copy. A message may be created, mutated by the API user, and sent multiple times.

The Message Object provides methods to manipulate the common Solace message header fields that are optionally sent in the binary metadata portion of the Solace message.

Applications can also use the structured data API solace.Message#setSdtContainer to add containers (maps or streams) and their fields to the binary payload or to the User Property map contained within the binary metadata.

This does not prevent applications from ignoring these methods and sending payload in the binary payload as an opaque binary field for end-to-end communications

Static Properties & Enumerations Detail Top

static public SOLCLIENT_USER_PROP_QUEUE_PARTITION_KEY

A standard property key that clients should use if they want to group messages into different queue partitions. Expected value is UTF-8 encoded up to 255 bytes long string.

Properties Detail Top

public readonly Boolean isAcknowledged

Returns whether acknowledge() has been called on this message.

public readonly Boolean isSettled

Returns whether settle(solace.MessageOutcome) has been called on this message.

Methods Detail Top

public void acknowledge ( )

Acknowledges this message. This is the same as calling solace.Message#settle(solace.MessageOutcome.ACCEPTED). Internally uses Message.settle() with the ACCEPTED MessageOutcome.

If the solace.MessageConsumer on which this message was received is configured to use solace.MessageConsumerAckMode.CLIENT, then when a message is received by an application, the application must call this method to explicitly acknowledge reception of the message. This frees local and router resources associated with an unacknowledged message.

The API does not send acknowledgments immediately. It stores the state for acknowledged messages internally and acknowledges messages, in bulk, when a threshold or timer is reached.

Return Value

void

Throws

solace.OperationError

public String dump ( Number flags )

Produces a human-readable dump of the message's properties and contents. Applications must not parse the output, as its format is not a defined part of the API and subject to change.

Output can be controlled by the flags parameter. The values are:

Parameters

Number flags

Optional flags controlling the output, such as whether to include verbose (binary dump) information

(Optional)

Return Value

String

A string representation of the message.

public String getApplicationMessageId ( )

Gets the application-provided message ID.

Return Value

String

The application provided message ID.

(Optional)

public String getApplicationMessageType ( )

Gets the application message type. This value is used by applications only, and is passed through the API and Solace Message Router untouched.

Return Value

String

The application message type.

(Optional)

public solace.Baggage getBaggage ( )

Retrieves a solace.Baggage carrier object used for carrying over of the distributed tracing message baggage information across service boundaries. It must not be altered by intermediaries.

Return Value

solace.Baggage

baggage carrier object associated with this message,

public Uint8Array | String | null getBinaryAttachment ( )

Gets the binary attachment part of the message.

Backward compatibility note: Using the version10 factory profile or older, the binary attachment is returned as a 'latin1' String: Each character has a code in the range * 0-255 representing the value of a single received byte at that position.

Return Value

Uint8Array | String | null

A TypedArray view of the binary attachment.

public Number getCacheRequestId ( )

Given a Message containing a cached message, return the cache Request Id that the application set in the call to solace.CacheSession#sendCacheRequest.

Return Value

Number

The request ID of the cache request associated with this message.

(Optional)

public solace.MessageCacheStatus getCacheStatus ( )

Gets the cache status of this message.

Return Value

solace.MessageCacheStatus

The cache status of this message. The status will be MessageCacheStatus.LIVE unless the message was returned in a reply to a cache request.

(Optional)

public String getCorrelationId ( )

Gets the correlation ID. The message Correlation Id is carried in the Solace message headers unmodified by the API and the Solace Message Router. This field may be used for peer-to-peer message synchronization and is commonly used for correlating a request to a reply. See solace.Session#sendRequest.

Return Value

String

The correlation ID associated with the message.

(Optional)

public Object getCorrelationKey ( )

Gets the correlation Key. A correlation key is used to correlate a message with its acknowledgement or rejection. The correlation key is an object that is passed back to the client during the router acknowledgement or rejection.

The correlation key is a local reference used by applications generating Guaranteed messages. Messages that are sent in either solace.MessageDeliveryModeType.PERSISTENT or solace.MessageDeliveryModeType.NON_PERSISTENT mode may set the correlation key.

Return Value

Object

The correlation Key associated with the message, or null, if unset.

(Optional)

public solace.TraceContext getCreationContext ( )

Retrieves a solace.TraceContext object used for carrying over of the distributed tracing message creation context information usable by intermediary instrumentation across service boundaries. It allows correlating the producer with the consumers of a message, regardless of intermediary instrumentation. It must not be altered by intermediaries.

Return Value

solace.TraceContext

Message creation context object associated with this message;

public Number | undefined getDeliveryCount ( )

Returns the delivery count.

Return Value

Number | undefined

The delivery count reported by the broker.

Throws

solace.OperationError

if endpoint does not report delivery count (message is not persistent).

public solace.MessageDeliveryModeType getDeliveryMode ( )

Gets the delivery mode of the message.

Return Value

solace.MessageDeliveryModeType

representing the delivery mode of the message.

public Destination getDestination ( )

Gets the destination to which the message was published.

Return Value

Destination

The destination to which a message was published.

(Optional)

public Number | undefined getGMExpiration ( )

Return Value

Number | undefined

The Guaranteed Message expiration value. The expiration time is the UTC time (that is, the number of milliseconds from midnight January 1, 1970 UTC) when the message is to expire.

public Long getGuaranteedMessageId ( )

This message ID is NOT a universal unique identifier for the message. There is no use for this message ID in an application. Internally this message ID is used when a message is acknowledged calling Message.acknowledge(). No other meaning should be inferred from the value of this message ID.

Deprecated: There is no useful purpose for this method. Do not use it.

Return Value

Long

A field in the message structure intended for internal use.

(Optional)

public String getHttpContentEncoding ( )

Gets the Http Content Encoding

Return Value

String

the http content encoding, if set.

(Optional)

public String getHttpContentType ( )

Gets the Http Content Type

Return Value

String

the http content type, if set.

(Optional)

public solace.MessageConsumer getMessageConsumer ( )

Return Value

solace.MessageConsumer

The associated Message Consumer, if received by a consumer

(Optional)

public Number getPriority ( )

Gets the Message Priority Parameter (JMS Priority) value for the message. Numerical values between 0 and 255 are valid return values, undefined means the parameter is not present.

If destination queues and topic endpoints for this message are configured to respect message priority, the values 0 through 9 can be used to affect the priority of delivery to consumers of those queues or topic endpoints. For the purposes of prioritized message delivery, values larger than 9 are treated the same as 9.

Return Value

Number

The Message Priority Parameter value.

public Number getReceiverTimestamp ( )

Gets the receive timestamp (in milliseconds, from midnight, January 1, 1970 UTC).

Return Value

Number

The receive timestamp, if set.

(Optional)

public solace.ReplicationGroupMessageId getReplicationGroupMessageId ( )

Returns the Replication Group Message Id

Return Value

solace.ReplicationGroupMessageId

The replication group message id assigned by the router.

(Optional)

public solace.Destination getReplyTo ( )

Gets the replyTo destination

Return Value

solace.Destination

The value of the replyTo destination, if set.

(Optional)

public SDTField | null getSdtContainer ( )

Gets the message's structured data container, if this is a structured data message.

Return Value

SDTField | null

A field with a payload of {String}, SDTMapContainer, or SDTStreamContainer if one was set in the message; otherwise, null.

public String getSenderId ( )

Returns the Sender's ID.

Return Value

String

The Sender's ID, if set.

(Optional)

public Number getSenderTimestamp ( )

Gets the send timestamp (in milliseconds, from midnight, January 1, 1970 UTC).

Return Value

Number

The send timestamp, if set.

(Optional)

public Number getSequenceNumber ( )

Gets the sequence number.

This is an application-defined field, see solace.Message#setSequenceNumber().

Return Value

Number

The sequence number, if set

(Optional)

Throws

solace.SDTUnsupportedValueError in case the sequence number is out of range.

public Number getSequenceNumber ( )

Gets the sequence number.

This is an application-defined field, see solace.Message#setSequenceNumber().

Return Value

Number

The sequence number, if set

(Optional)

Throws

solace.SDTUnsupportedValueError in case the sequence number is out of range.

public Number getTimeToLive ( )

Return Value

Number

The Guaranteed Message TTL, in milliseconds.

public Long getTopicSequenceNumber ( )

Returns the Topic Sequence Number. If there is no topic sequence number undefined is returned.

Return Value

Long

The Topic Sequence number assigned to this message by the Message Router.

(Optional)

public solace.TraceContextSetter getTraceContextSetter ( )

Retrieves a solace.TraceContextSetter object that is used to modify an appropriate TraceContext associated with a message transparently. When no context is stored in a message it will create and store a creation context with a message that can be used as an initial transport context at the same time. It will never override an existing message creation context. When creation context is present or only transport context is present, it will override an existing transport context information with a newly provided one.

Return Value

solace.TraceContextSetter

Transport context setter object associated with this message; never expected to be null

public solace.TraceContext getTransportContext ( )

Retrieves a solace.TraceContext object used for carrying over of the distributed tracing transport context information usable or modifiable by intermediary instrumentation across service boundaries. It allows correlating the producer and the consumer with an intermediary. It also allows correlating multiple intermediaries among each other.

Return Value

solace.TraceContext

Transport context object associated with this message;

public solace.MessageType getType ( )

Gets the payload type (solace.MessageType) of the message. A message has a structured payload if one was attached via solace.Message#setSdtContainer otherwise if the payload is attached via Message@setBinaryAttachment then it is unstructured (solace.MessageType#BINARY)

Return Value

solace.MessageType

The structured payload type.

public solace.MessageUserCosType getUserCos ( )

Gets the Class of Service (CoS) value for the message. The Class of Service has different semantics for direct and guaranteed messages.

For messages published with solace.MessageDeliveryModeType.DIRECT, the class of service selects the weighted round-robin delivery queue when the message is forwarded to a consumer. solace.MessageUserCosType.COS1 are the lowest priority messages and will use the Solace Message Router D-1 delivery queues.

For messages published as guaranteed messages (solace.MessageDeliveryModeType.PERSISTENT or solace.MessageDeliveryModeType.NON_PERSISTENT), messages published with solace.MessageUserCosType.COS1 can be rejected by the Solace Message Router if that message would cause any queue or topic-endpoint to exceed its configured low-priority-max-msg-count.

Return Value

solace.MessageUserCosType

The COS value.

public String getUserData ( )

Gets the user data part of the message.

Return Value

String

The user data part of the message, if set.

public solace.SDTMapContainer getUserPropertyMap ( )

Gets the user property map carried in the message binary metadata.

Return Value

solace.SDTMapContainer

The user properties map, if set.

(Optional)

public String getXmlContent ( )

Gets the XML content part of the message. Notice that the content is encoded as UTF-8 characters, it needs to be decoded as JavaScript surrogate pair: decodeURIComponent(escape(value))

Return Value

String

The XML content part of the message, if set.

(Optional)

public String getXmlContentDecoded ( )

Gets the XML content part of the message decoded from UTF-8 encoding of the characters.

Return Value

String

The XML content part of the message. Returns null if not present.

(Optional)

public String getXmlMetadata ( )

Gets the message's XML metadata section.

Return Value

String

The XML metadata, if set.

(Optional)

public Boolean isAcknowledgeImmediately ( )

Test if the Acknowledge Immediately message property is set or not. When the Acknowledge Immediately property is set to true on an outgoing Guaranteed Message, it indicates that the Solace Message Router should Acknowledge this message immediately upon receipt.

This property, when set by a publisher, may or may not be removed by the Solace Message Router prior to delivery to a consumer, so message consumers must not expect the property value indicates how the message was originally published

Return Value

Boolean

Whether this message was set to acknowledge immediately.

public Boolean isDeliverToOne ( )

Gets whether the message is configured for delivering to one client only.

Deprecated: use Shared Subscriptions instead.

Return Value

Boolean

indicates whether the message is configured for delivering to one client only.

public Boolean isDiscardIndication ( )

Indicates whether one or more messages have been discarded prior to the current message. This indicates congestion discards only and is not affected by message eliding.

Return Value

Boolean

Returns true if one or more messages have been discarded prior to the current message; otherwise, it returns false.

public Boolean isDMQEligible ( )

Return Value

Boolean

Whether this message is Guaranteed Message DMQ eligible

public Boolean isElidingEligible ( )

Returns whether the message is eligible for eliding.

Message eliding enables filtering of data to avoid transmitting every single update to a subscribing client.

This property does not indicate whether the message was elided.

Return Value

Boolean

indicates whether the message is eligible for eliding.

public Boolean isRedelivered ( )

Indicates whether the message has been marked as redelivered by the Solace Message Router.

Return Value

Boolean

Indicates whether the redelivered flag is set.

public Boolean isReplyMessage ( )

Returns whether the message's reply field is set, indicating that this message is a reply to a previous request. See solace.Session#sendRequest.

Return Value

Boolean

Indicates the state of the reply field.

public void reset ( )

Releases all memory associated with this message. All values are reinitialized to defaults. The message is no longer associated with any session or consumer.

Return Value

void

public void setAcknowledgeImmediately ( Boolean value )

Set the optional Acknoweledge Immediately message property. When the Acknowledge Immediately property is set to true on an outgoing Guaranteed Message, it indicates that the Solace Message Router should acknoweledge this message immediately upon receipt. By default the property is set to false on newly created messages.

This property, when set by a publisher, may or may not be removed by the appliance prior to delivery to a consumer, so message consumers must not expect the property value indicates how the message was originally published. Therefore if a received message is forwarded by the application, the Acknowledge Immediately property should be explicitly set to the desired value (true or false).

Setting this property on an outgoing direct message has no effect.

Parameters

Boolean value

Whether to acknowledge this message immediately.

Return Value

void

public void setApplicationMessageId ( String value )

Sets the application-provided message ID.

Parameters

String value

The new value for the application-provided message ID.

(Optional)

Return Value

void

public void setApplicationMessageType ( String value )

Sets the application message type. This value is used by applications only, and is passed through the API and Solace Message Router untouched.

Parameters

String value

The application message type.

(Optional)

Return Value

void

public void setAsReplyMessage ( Boolean value )

Sets the reply field of the message.

Parameters

Boolean value

Sets whether to flag the message as a reply.

Return Value

void

public void setBinaryAttachment ( Uint8Array | ArrayBufferLike | DataView | String | null | undefined value )

Sets the binary attachment part of the message.

The binary attachment is conceptually an array of bytes. When this method is used, the message payload type is solace.MessageType#BINARY See solace.Message#getType.

Applications may set the binary attachment to NULL or undefined to remove the binary attachment and create a message with no payload.

The following types are accepted: Buffer (the nodeJS native type or equivalent) ArrayBuffer, Any DataView or TypedArray, 'latin1' String for backwards compatibility: each character has a code in the range 0-255 representing exactly one byte in the attachment.

Parameters

Uint8Array | ArrayBufferLike | DataView | String | null | undefined value

Sets the binary attachment part of the message.

Return Value

void

public void setCorrelationId ( String | null | undefined value )

Sets the correlation ID. The message Correlation Id is carried in the Solace message headers unmodified by the API and the Solace Message Router. This field may be used for peer-to-peer message synchronization and is commonly used for correlating a request to a reply. See solace.Session#sendRequest.

Parameters

String | null | undefined value

The correlation ID to associate with the message.

Return Value

void

public void setCorrelationKey ( Object | String | null | undefined value )

Sets the correlation Key. A correlation key is used to correlate a message with its acknowledgement or rejection. The correlation key is an object that is passed back to the client during the router acknowledgement or rejection.

The correlation key is a local reference used by applications generating Guaranteed Messages. Messages that are sent in either solace.MessageDeliveryModeType.PERSISTENT or solace.MessageDeliveryModeType.NON_PERSISTENT mode may set the correlation key. If this method is used, the correlation information is returned when the solace.SessionEventCode#event:ACKNOWLEDGED_MESSAGE event is later received for an acknowledged message or when the solace.SessionEventCode#event:REJECTED_MESSAGE_ERROR is received for a rejected message.

The API only maintains a reference to the passed object. If the application requires the contents are unmodified for proper correlation, then it is the application's responsibility to ensure the contents of the object are not modified.

Important: The Correlation Key is not included in the transmitted message and is only used with the local API

Parameters

Object | String | null | undefined value

The correlation Key to associate with the message.

Return Value

void

public void setDeliverToOne ( Boolean value )

Sets whether the message is configured for delivering to one client only.

Deprecated: use Shared Subscriptions instead.

Parameters

Boolean value

whether the message is configured for delivering to one client only.

Return Value

void

public void setDeliveryMode ( solace.MessageDeliveryModeType value )

Sets the delivery mode of the message.

Parameters

solace.MessageDeliveryModeType value

The message delivery mode.

Return Value

void

public void setDestination ( Destination value )

Sets the destination (solace.DestinationType#Topic or solace.DestinationType#Queue) to publish the message to.

Parameters

Destination value

The destination to publish the message to.

Return Value

void

public void setDMQEligible ( Boolean value )

Parameters

Boolean value

The new value for Guaranteed Message DMQ (Dead Message Queue) Eligible. When this property is set, when the message expires in the network the message is saved on a appliance dead message queue. Otherwise the expired message is discarded. See solace.Message#setTimeToLive.

Return Value

void

public void setElidingEligible ( Boolean value )

Sets whether the message is eligible for eliding.

Message eliding enables filtering of data to avoid transmitting every single update to a subscribing client.

This property does not indicate whether the message was elided.

Parameters

Boolean value

sets whether the message is eligible for eliding.

Return Value

void

public void setGMExpiration ( Number value )

Set the expiration time field. The expiration time is the UTC time (that is, the number of milliseconds from midnight January 1, 1970 UTC) when the message is to expire. The expiration time is carried in the message when set to a non-zero value. Expiration time is not included when this value is set to zero or undefined

The message expiration time is carried to clients that receive the message unmodified and does not effect the life cycle of the message. Use solace.Message#setTimeToLive to enforce message expiry in the network.

Parameters

Number value

The new Guaranteed Message expiration value

(Optional)

Return Value

void

public void setHttpContentEncoding ( String value )

Sets the Http Content Encoding

Parameters

String value

The http content encoding.

Return Value

void

public void setHttpContentType ( String value )

Sets the Http Content Type

Parameters

String value

The http content type.

Return Value

void

public void setPriority ( Number value )

Sets the Message Priority Parameter (JMS Priority) value for the message. Numerical values between 0 and 255 are accepted, use undefined to unset.

If destination queues and topic endpoints for this message are configured to respect message priority, the values 0 through 9 can be used to affect the priority of delivery to consumers of those queues or topic endpoints. For the purposes of prioritized message delivery, values larger than 9 are treated the same as 9.

Parameters

Number value

The priority value.

(Optional)

Return Value

void

public void setReplyTo ( solace.Destination value )

Sets the replyTo destination

Parameters

solace.Destination value

The replyTo destination.

Return Value

void

public void setSdtContainer ( solace.SDTField container )

Makes this message a strutured data message by assigning it a structured data type (SDT) container payload (such as a solace.SDTMapContainer, solace.SDTStreamContainer or a solace.SDTFieldType.String, which is transported in the binary attachment field.

Assigning a SDT container updates the message's Type property to the appropriate value.

The container argument must be a solace.SDTField with a type of solace.SDTFieldType.MAP, solace.SDTFieldType.STREAM, or solace.SDTFieldType.STRING.

Parameters

solace.SDTField container

The SDTField container to send in this message.

(Optional)

Return Value

void

public void setSenderId ( String value )

Sets the Sender ID for the message

Parameters

String value

The Sender ID for the message.

Return Value

void

public void setSenderTimestamp ( Number value )

Sets the send timestamp (in milliseconds, from midnight, January 1, 1970 UTC). This field can be generated automatically during message publishing, but it will not be generated if previously set to a non-null value by this method. See solace.SessionProperties#generateSendTimestamps.

An application that publishes the same solace.Messsage multiple times and also wants generted timestamps on each messages, should set the sender timestamp to undefined after each call to solace.Session#send.

Parameters

Number value

The value to set as the send timestamp.

(Optional)

Return Value

void

public void setSequenceNumber ( Number value )

Sets the application-defined sequence number. If the sequence number is not set, or set to undefined, and solace.SessionProperties#generateSequenceNumber is true, then a sequence number is automatically generated for each sent message.

Parameters

Number value

The sequence number.

(Optional)

Return Value

void

public void setTimeToLive ( Number value )

Parameters

Number value

The Guaranteed Message TTL to set, in milliseconds.

The time to live is the number of milliseconds the message may be stored on the Solace Message Router before the message is discarded or moved to a Dead Message Queue. See solace.Message.setDMQEligible.

Setting the Time To Live to zero disables TTL for the message.

This property is only valid for Guaranteed messages (Persistent and Non-Persistent). It has no effect when used in conjunction with other message types unless the message is promoted by the appliance to a Guaranteed message.

The maxium allowed time to live is 3.1536E11 (315360000000) which is approximately 10 years.

Return Value

void

public void settle ( solace.MessageOutcome messageSettlementOutcome )

Settles this message in a requested way.

If the solace.MessageConsumer on which this message was received is configured to use solace.MessageConsumerAckMode.CLIENT, then when a message is received by an application, the application must call this method to explicitly acknowledge reception of the message. This frees local and router resources associated with an unacknowledged message.

The API does not send acknowledgments immediately. It stores the state for acknowledged messages internally and acknowledges messages, in bulk, when a threshold or timer is reached.

See solace.MessageOutcomefor detailed explanation of available options

Parameters

solace.MessageOutcome messageSettlementOutcome

type of the settlement outcome, not expected to be {@code null}

Return Value

void

Throws

solace.OperationError

public void setTransportContext ( solace.TraceContextSetter contextSetter )

Set the transport context. Called when the message is received from broker

Parameters

solace.TraceContextSetter contextSetter

Return Value

void

public void setUserCos ( solace.MessageUserCosType value )

Sets the Class of Service (CoS) value for the message.

The Class of Service has different semantics for direct and guaranteed messages.

For messages published with solace.MessageDeliveryModeType.DIRECT, the class of service selects the weighted round-robin delivery queue when the message is forwarded to a consumer. solace.MessageUserCosType#COS1 are the lowest priority messages and will use the Solace Message Router D-1 delivery queues.

For messages published as guaranteed messages (solace.MessageDeliveryModeType.PERSISTENT or solace.MessageDeliveryModeType.NON_PERSISTENT), messages published with solace.MessageUserCosType#COS1 can be rejected by the Solace Message Router if that message would cause any queue or topic-endpoint to exceed its configured low-priority-max-msg-count.

Parameters

solace.MessageUserCosType value

The COS value.

Return Value

void

public void setUserData ( String value )

Sets the user data part of the message.

Parameters

String value

The user data part of the message.

Return Value

void

public void setUserPropertyMap ( SDTMapContainer value )

Allows users to specify their own user properties to be carried in the message binary metadata separate from the payload.

Parameters

SDTMapContainer value

The user property map.

(Optional)

Return Value

void

public void setXmlContent ( String value )

Sets the XML content part of the message. The content is encoded by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.

Parameters

String value

The XML content part of the message.

Return Value

void

public void setXmlMetadata ( String value )

Sets the message's XML metadata section.

Parameters

String value

The XML metadata.

Return Value

void