TsgcWSPClient_STOMP_RabbitMQ › Methods › BeginTransaction
Starts a named STOMP transaction used to group SEND and ACK frames atomically.
procedure BeginTransaction(const aTransaction: String);
| Name | Type | Description |
|---|---|---|
aTransaction | const String | Unique identifier used to correlate subsequent SEND, ACK, NACK, COMMIT and ABORT frames that belong to the same transaction. |
STOMP transactions in RabbitMQ apply to sending and acknowledging frames: every SEND, ACK or NACK carrying the same transaction header is buffered by the broker and only processed when CommitTransaction is received. AbortTransaction discards all buffered frames.
sgcRabbitMQ.BeginTransaction('tx-1');
sgcRabbitMQ.PublishQueue('orders', 'order-1', CS_TEXT_PLAIN, 'tx-1');
sgcRabbitMQ.PublishQueue('orders', 'order-2', CS_TEXT_PLAIN, 'tx-1');
sgcRabbitMQ.CommitTransaction('tx-1');