Skip to content

Commit 265c9fc

Browse files
authored
fix: correct consumer.fetch options typing and docs (#132)
1 parent 6dbcaf5 commit 265c9fc

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

docs/consumer.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ The return value is the raw response from Kafka.
108108

109109
Options:
110110

111-
| Property | Type | Description |
112-
| -------- | --------------------- | -------------------------------- |
113-
| node | number | Node to consume data from. |
114-
| topics | `FetchRequestTopic[]` | Topic and partitions to consume. |
111+
| Property | Type | Default | Description |
112+
| -------------- | --------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
113+
| node | number | | Node to consume data from. |
114+
| topics | `FetchRequestTopic[]` | | Topic and partitions to consume. |
115+
| minBytes | `number` | `1` | Minimum amount of data the brokers should return. The value might not be respected by Kafka. |
116+
| maxBytes | `number` | 10MB | Maximum amount of data the brokers should return. The value might not be respected by Kafka. |
117+
| maxWaitTime | `number` | 5 seconds | Maximum amount of time in milliseconds the broker will wait before sending a response to a fetch request. |
118+
| isolationLevel | `string` | `READ_COMMITTED` | Kind of isolation applied to fetch requests. It can be used to only read producers-committed messages.<br/><br/> The valid values are defined in the `FetchIsolationLevels` enumeration. |
115119

116120
Note that all the partitions must be hosted on the node otherwise the operation will fail.
117121

src/clients/consumer/types.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,13 @@ export type ConsumeOptions<Key, Value, HeaderKey, HeaderValue> = StreamOptions &
103103
export type ConsumerOptions<Key, Value, HeaderKey, HeaderValue> = BaseOptions & { groupId: string } & GroupOptions &
104104
ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue>
105105

106-
export type FetchOptions<Key, Value, HeaderKey, HeaderValue> = Omit<
106+
export type FetchOptions<Key, Value, HeaderKey, HeaderValue> = Pick<
107107
ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue>,
108-
'deserializers'
109-
> &
110-
GroupOptions & {
111-
node: number
112-
topics: FetchRequestTopic[]
113-
}
108+
'minBytes' | 'maxBytes' | 'maxWaitTime' | 'isolationLevel'
109+
> & {
110+
node: number
111+
topics: FetchRequestTopic[]
112+
}
114113

115114
export interface CommitOptionsPartition extends TopicWithPartitionAndOffset {
116115
leaderEpoch: number

0 commit comments

Comments
 (0)