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

examples: rdkafka example using message_record type which doesn't implement ToBytes trait #244

Open
cduggn opened this issue Nov 26, 2024 · 0 comments

Comments

@cduggn
Copy link

cduggn commented Nov 26, 2024

Looking to add a fix or get clarification on how to use example at example-projects/rdkafka-example

   let message_record =
                MessageRecord::from_event(event).expect("error while serializing the event");

            let delivery_status = producer
                .send(
                    FutureRecord::to(topic_name)
                        .message_record(&message_record)
                        .key(&format!("Key {}", i)),
                    Duration::from_secs(10),
                )
                .await;
  • Producer example is attempting to use MessageRecord to serialize events and send directly to Kafka.
  • The FutureRecord types however requires a payload that implements ToBytes. MessageRecord doesn't have an impl for this
  • It does have a payload field type Vec but that field is only visible to the rdkafka crate .

Adding a function for example pub fn payload and pub fn headerson MessageRecord would make the payload and header fields accessible

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

No branches or pull requests

1 participant