public interface TransactionManager
Modifier and Type | Method and Description |
---|---|
<T> Mono<T> |
abort()
Aborts the current transaction.
|
<T> Mono<T> |
begin()
Begins a new transaction.
|
<T> Mono<T> |
commit()
Commits the current transaction.
|
Scheduler |
scheduler()
Returns the scheduler associated with this transaction instance.
|
default <T> Mono<T> |
sendOffsets(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets,
org.apache.kafka.clients.consumer.ConsumerGroupMetadata metadata)
Sends provided offsets to the consumer offsets topic.
|
<T> Mono<T> |
sendOffsets(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets,
String consumerGroupId)
Deprecated.
in favor of #sendOffsets(Map
|
default TransactionManager |
transactionComplete(Consumer<Boolean> txComplete)
A callback to indicate a commit or rollback has completed, true for commit.
|
<T> Mono<T> begin()
KafkaProducer.beginTransaction()
for more details.
No other operations may be performed on this sender while this begin operation is in progress.
Example usage:
transactionManager = kafkaSender.transactionManager();
transactionManager.begin()
.then(kafkaSender.send(outboundFlux))
.then(transactionManager.commit());
@Deprecated <T> Mono<T> sendOffsets(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, String consumerGroupId)
KafkaProducer.sendOffsetsToTransaction(Map, String)
for details on updating consumer offsets
within a transaction.offsets
- Consumer offsets to updateconsumerGroupId
- The consumer group id for which offsets are updatedMono
that completes when the offsets have been sent to the consumer offsets topic.
The offsets will be committed when the current transaction is committed.default <T> Mono<T> sendOffsets(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, org.apache.kafka.clients.consumer.ConsumerGroupMetadata metadata)
KafkaProducer.sendOffsetsToTransaction(Map, ConsumerGroupMetadata)
for details on updating consumer
offsets within a transaction.offsets
- Consumer offsets to updatemetadata
- The consumer group metadataMono
that completes when the offsets have been sent to the consumer offsets topic.
The offsets will be committed when the current transaction is committed.<T> Mono<T> commit()
KafkaProducer.commitTransaction()
for details.Mono
that completes when the transaction is committed.<T> Mono<T> abort()
KafkaProducer.abortTransaction()
for details.Mono
that completes when the transaction is aborted.Scheduler scheduler()
KafkaSender
are published on
this scheduler. This scheduler is configured using SenderOptions.scheduler(Scheduler)
and it must be single threaded.default TransactionManager transactionComplete(Consumer<Boolean> txComplete)
txComplete
- the commitComplete to set.