TsgcWSPClient_STOMP_ActiveMQMethods › BeginTransaction

BeginTransaction Method

Sends a BEGIN frame starting a new transaction identified by the supplied id.

Syntax

procedure BeginTransaction(const aTransaction: String);

Parameters

NameTypeDescription
aTransactionconst StringClient-generated transaction id; the same id must later be passed to CommitTransaction or AbortTransaction.

Remarks

STOMP transactions group SEND and ACK/NACK operations so they are processed atomically by the ActiveMQ broker. After BeginTransaction, pass the same id in the aTransaction parameter of PublishEx, PublishTopic, PublishQueue, ACK or NACK; nothing is visible to other subscribers until CommitTransaction is called. Invoke AbortTransaction to discard all buffered operations.

Example

oActiveMQ.BeginTransaction('tx-1');
oActiveMQ.PublishQueue('orders', 'msg-1', 'text/plain', 'tx-1');
oActiveMQ.PublishQueue('orders', 'msg-2', 'text/plain', 'tx-1');
oActiveMQ.CommitTransaction('tx-1');

Back to Methods