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

Support record headers #604

Merged
merged 7 commits into from
Jun 18, 2018
Merged

Support record headers #604

merged 7 commits into from
Jun 18, 2018

Conversation

0x2c7
Copy link
Contributor

@0x2c7 0x2c7 commented Jun 16, 2018

From Kafka 0.11.0, the new record batch format supports optional headers field for each message. This helps a lot in tracing, monitoring, as well as other stuff since it allows us to attach the metadata without messing up the main message content. The previous record batch implement PR already supports this field in record batch encoding / decoding. This PR is to implement the interfaces for the outsider to make use of this feature. The interfaces are available in Kafka::Client and Kafka::Producer and Kafka::AsyncProducer.

kafka.deliver_message(
   'hello', topic: 'world', headers: { 'TracingID' => 'a1234', 'SpanID' => '4567' }
)
producer = kafka.producer
producer.produce(
  'hello', topic: 'world', headers: { 'TracingID' => 'a1234', 'SpanID' => '4567' }
)

The consumer could access record headers via:

consumer.each_message do |message|
  puts message.headers
end

cc @mensfeld

Copy link
Collaborator

@dasch dasch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@dasch dasch merged commit ac69912 into zendesk:master Jun 18, 2018
@0x2c7 0x2c7 deleted the chore/record-headers branch June 18, 2018 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants