Enable transaction support in the Pulsar broker configuration and ensure the transaction coordinator is running (verify required broker config keys against current Pulsar docs).
Create a transactional client by enabling transactions in PulsarClientBuilder: .enableTransaction(true).
Begin a transaction: Transaction txn = pulsarClient.newTransaction().withTransactionTimeout(5, TimeUnit.MINUTES).build().get().
Send messages and acknowledge consumed messages within the transaction by passing the txn object to producer.newMessage(txn).value(data).send() and consumer.acknowledgeAsync(msgId, txn).
Commit with txn.commit().get() or abort with txn.abort().get() on failure; committed sends and acks become visible atomically.
Known gotchas
Pulsar transactions require transaction coordinator partitions to be configured; misconfiguration causes transaction creation to fail. Verify setup steps in current Pulsar docs.
Transaction timeout must exceed the maximum processing time for a single transaction; expired transactions are automatically aborted by the broker.
Transactional acknowledgment only works with individual ack mode (not cumulative); and transactional producers/consumers have additional overhead compared to non-transactional ones.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp