Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/Transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ You initialize a transaction by making an async call to `producer.transaction()`

> Note: Kafka requires that the transactional producer have the following configuration to _guarantee_ EoS ("Exactly-once-semantics"):
>
> - The producer must have a max in flight requests of 1
> - The producer must have a max in flight requests of 5
> - The producer must wait for acknowledgement from all replicas (acks=-1)
> - The producer must have unlimited retries

Configure the producer client with `maxInFlightRequests: 1` and `idempotent: true` to guarantee EOS. Configuring the two options will enable the settings mentioned above.
Configure the producer client with `maxInFlightRequests: 5` and `idempotent: true` to guarantee EOS. Configuring the two options will enable the settings mentioned above.

```javascript
const client = new Kafka({
clientId: 'transactional-client',
brokers: ['kafka1:9092', 'kafka2:9092'],
})
const producer = client.producer({ maxInFlightRequests: 1, idempotent: true })
const producer = client.producer({ maxInFlightRequests: 5, idempotent: true })
```

Within a transaction, you can produce one or more messages. If `transaction.abort` is called, all messages will be rolled back.
Expand Down