Search code examples
apache-kafkaspring-cloud-dataflow

Record in Kafka 0.10 coming with contentType even after using app.spring.cloud.stream.bindings.output.producer.headerMode=raw


I have created a simple stream in spring cloud dataflow where I have http as source and kafka as sink.

stream create --definition "http --port=<yyyy> --path-pattern=/test  > :streamtest1" --name ingest_to_broker_from_http --deploy --properties app.spring.cloud.stream.bindings.output.producer.headerMode=raw

Even after using app.spring.cloud.stream.bindings.output.producer.headerMode=raw, I am receiving Kafka messages with contentType application string.

cURL Command:

curl -X POST -H "Content-Type: application/json" --data '{"name":"test6"}' http://<xxxx>:<yyyy>/test

Kafka Message:

contentType "text/plain"originalContentType "application/json;charset=UTF-8"{"name":"test6"}

  • Am I passing the headerMode property in a correct way?
  • What should I do to receive only the message (without header) in Kafka topic?

Solution

  • Resolved.

    Changed the below property:

    app.http.spring.cloud.stream.bindings.output.producer.headerMode=raw