Skip to main content
Version: Next

Advanced features

You can use the following advanced features with transactions in Pulsar.

Ack batch messages

If you want to acknowledge batch messages with transactions, set acknowledgmentAtBatchIndexLevelEnabled to true in the broker.conf or standalone.conf file.

acknowledgmentAtBatchIndexLevelEnabled=true

This example enables batch messages ack in transactions in the consumer builder.

Consumer<byte[]> consumer = pulsarClient
.newConsumer()
.topic(transferTopic)
.subscriptionName("transaction-sub")
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.subscriptionType(SubscriptionType.Shared)
.enableBatchIndexAcknowledgment(true) // enable batch index acknowledgment
.subscribe();

Enable authentication

If you want to enable authentication with transactions, follow the steps below.

  1. Grant "consume" permission to the persistent://pulsar/system/transaction_coordinator_assign topic.

  2. Configure authentication in a Pulsar client.

Guarantee exactly-once semantics

If you want to guarantee exactly-once semantics with transactions, you can enable message deduplication at the broker, namespace, or topic level.