TsgcWSPClient_STOMP_ActiveMQ › Methods › BeginTransaction
Sends a BEGIN frame starting a new transaction identified by the supplied id.
procedure BeginTransaction(const aTransaction: String);
| Name | Type | Description |
|---|---|---|
aTransaction | const String | Client-generated transaction id; the same id must later be passed to CommitTransaction or AbortTransaction. |
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.
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');