Publishing Messages in Transactions

To publish Guaranteed messages in a transaction, a producer flow must first be established in the transacted session:

  • For the Java RTO, C, and .NET APIs, when a transacted session is successfully created a producer flow is automatically created in that transacted session if the following transacted session properties are enabled (this is the default behavior):
    • Java RTO API: TransactedSessionHandle.PROPERTIES.HAS_PRODUCER
    • C API: SOLCLIENT_TRANSACTEDSESSION_PROP_HAS_PRODUCER
    • .NET API: TransactedSessionProperties.HasProducer

After establishing a producer flow, Guaranteed messages can be published through one of the send methods or functions listed below.

In a transaction, the event broker stages the published messages, and they are not delivered to their destinations on the event broker until the client issues a commit. A successful commit will deliver the messages to their destinations and remove the staging information.

To Send Messages in Transactions

PubSub+ Messaging API Use

Java RTO

TransactedSessionHandle.send(...)

C

solClient_transactedSession_sendMsg(...)

.NET

ITransactedSession.send(...)

How Endpoints’ Message Discard Behavior Affects Transactions

When a message published in a transaction cannot be successfully spooled to any of its destination endpoints on a commit, the message is discarded. In this case, whether or not the commit is successful depends on the endpoint’s message discard behavior property, which determines how the endpoint handles a discarded message.

If the message discard behavior property for the endpoint is not enabled, the message is ‘silently’ discarded (that is, the endpoint discards the message but returns a commit success response to the client), and the commit completes. In this case, the message can be spooled to other endpoints that it may have been destined for.

When provisioning a queue, by default the message discard behavior property is enabled; when provisioning a topic endpoint, by default the property is not enabled.

For information on the message discard behavior endpoint property and the conditions that can cause an endpoint to not spool and then discard a message, see Defining Endpoint Properties.