Skip to content

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

Open
@cduggn

Description

@cduggn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions