Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header cannot be written in producer message #546

Closed
TheZwieback opened this issue Nov 6, 2019 · 3 comments
Closed

Header cannot be written in producer message #546

TheZwieback opened this issue Nov 6, 2019 · 3 comments
Labels

Comments

@TheZwieback
Copy link
Contributor

Hi,
The header and message types are defined as:

export interface Message {
  key?: Buffer | string | null
  value: Buffer | string | null
  partition?: number
  headers?: IHeaders
  timestamp?: string
}

export interface IHeaders {
  [key: string]: Buffer
}

This excludes writing headers as key value pairs as described in the documentation, see https://kafka.js.org/docs/producing#message-headers . Is there a way to fix this currently?

Thanks,
Christian

@tulios
Copy link
Owner

tulios commented Nov 6, 2019

Hi @TheZwieback we should accept strings as well, can you create a PR and fix the IHeaders type? The Typescript definitions arrived late in the project and are still not quite right.

optionally you can Buffer.from('string') the values for now.

@tulios tulios added the question label Nov 6, 2019
@TheZwieback
Copy link
Contributor Author

Thanks for the quick reply. I changed the type definition and created a pull request.

@Nevon
Copy link
Collaborator

Nevon commented Nov 8, 2019

Fixed by #547

@Nevon Nevon closed this as completed Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants