You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by amruta dale <am...@gmail.com> on 2020/04/06 10:14:22 UTC

How to post Kafka Avro records with httpclient

Hi Team,

I have written my own Producer interceptor in Java for Kafka Producer.
During intercepting I am trying to push avro message (record.value()) to
one of the API via httpclient post method.

I can send the simple messages to api however somehow  for avro message I
am unable to do so.

Like we use stringEntity for simple text messages ,what canwe use for Avro
messages.


Regards,
Amruta

Re: How to post Kafka Avro records with httpclient

Posted by amruta dale <am...@gmail.com>.
Hi Bernd,

Thanks for your revert. I am trying below but no luck. Can you please share
any link as I have searched on web but didnt find nay good stuff around
this.
httpPost.setEntity (new byteArrayEntity ((byte[])record.value())

Regards,
Amruta

On Mon, Apr 6, 2020 at 3:47 PM Bernd Eckenfels <ec...@zusammenkunft.net>
wrote:

> You post the serialized Avro message as a byte array (or other protocols
> like bas64 form fields or whatever the server expects). Text mode might not
> be the most efficient protocol to use.
>
> Greetings
> Bernd
> --
> http://bernd.eckenfels.net
> ________________________________
> Von: amruta dale <am...@gmail.com>
> Gesendet: Monday, April 6, 2020 12:14:22 PM
> An: httpclient-users@hc.apache.org <ht...@hc.apache.org>
> Betreff: How to post Kafka Avro records with httpclient
>
> Hi Team,
>
> I have written my own Producer interceptor in Java for Kafka Producer.
> During intercepting I am trying to push avro message (record.value()) to
> one of the API via httpclient post method.
>
> I can send the simple messages to api however somehow  for avro message I
> am unable to do so.
>
> Like we use stringEntity for simple text messages ,what canwe use for Avro
> messages.
>
>
> Regards,
> Amruta
>

Re: How to post Kafka Avro records with httpclient

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
You post the serialized Avro message as a byte array (or other protocols like bas64 form fields or whatever the server expects). Text mode might not be the most efficient protocol to use.

Greetings
Bernd
--
http://bernd.eckenfels.net
________________________________
Von: amruta dale <am...@gmail.com>
Gesendet: Monday, April 6, 2020 12:14:22 PM
An: httpclient-users@hc.apache.org <ht...@hc.apache.org>
Betreff: How to post Kafka Avro records with httpclient

Hi Team,

I have written my own Producer interceptor in Java for Kafka Producer.
During intercepting I am trying to push avro message (record.value()) to
one of the API via httpclient post method.

I can send the simple messages to api however somehow  for avro message I
am unable to do so.

Like we use stringEntity for simple text messages ,what canwe use for Avro
messages.


Regards,
Amruta