Skip to content

Kafka header from feeder #110

Open
Killen911 opened this issue Nov 30, 2022 · 3 comments
Open

Kafka header from feeder #110

Killen911 opened this issue Nov 30, 2022 · 3 comments

Comments

@Killen911
Copy link

Killen911 commented Nov 30, 2022

Hi.
Is possible to send kafka headers from feeder in this plugin?
Need something like this:
.exec(kafka("my-topic").send[String,String]("{ \"kafka\": \"message\"", session => session("headers")))

@3alster
Copy link

3alster commented Feb 6, 2023

It's possible to set a header from a session parameter like this

   .exec(s => s.set("custom", new RecordHeaders().add("test-header", s("kekey").as[Array[Byte]])))
   .exec(
      kafka("BasicRequest")
        .send[String, String]("foo", "foo", "#{custom}"),
    )```

@partheebanMani
Copy link

@3alster I tried as suggested in Java, but I am getting error as header is in string , expected is 'Header' format

WhatsApp Image 2023-06-14 at 15 16 39

@3alster
Copy link

3alster commented Jul 6, 2023

Hi @partheebanMani, that's because you mixed up the types, just use RecordHeaders type instead of the Session for the headers variable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants