Skip to content

Commit

Permalink
Merge pull request #1401 from tulios/fix-message-size-type
Browse files Browse the repository at this point in the history
Differentiate KafkaMessage type between Record and Message
  • Loading branch information
Nevon authored Jun 28, 2022
2 parents 196105c + e1b016e commit 48b8bc7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,16 +631,28 @@ export type Broker = {
}): Promise<any>
}

export type KafkaMessage = {
interface MessageSetEntry {
key: Buffer | null
value: Buffer | null
timestamp: string
attributes: number
offset: string
size: number
headers?: never
}

interface RecordBatchEntry {
key: Buffer | null
value: Buffer | null
timestamp: string
attributes: number
offset: string
headers?: IHeaders
headers: IHeaders
size?: never
}

export type KafkaMessage = MessageSetEntry | RecordBatchEntry

export interface ProducerRecord {
topic: string
messages: Message[]
Expand Down

0 comments on commit 48b8bc7

Please sign in to comment.