mkueng
mkueng

Reputation: 29

How to set Content-Type http header with Kafka Connect Camel Http Sink Connector

I'm using org.apache.camel.kafkaconnector.https.CamelHttpsSinkConnector as Kafka Connect http sink connector. How can a custom http header like Content-Type be set for the outgoing request?

Upvotes: 0

Views: 33

Answers (1)

mkueng
mkueng

Reputation: 29

Not sure if this is the best way but it works by using the InsertHeader transformer and setting the header name prefixed with "CamelHeader." so that it gets picked up by the connector.

Example yaml configuration:

  class: org.apache.camel.kafkaconnector.https.CamelHttpsSinkConnector
  config:
    transforms: addContentTypeHeader
    transforms.addAuthHeader.type: org.apache.kafka.connect.transforms.InsertHeader
    transforms.addAuthHeader.header: CamelHeader.Content-Type
    transforms.addAuthHeader.value.literal: application/json

Upvotes: 0

Related Questions