Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream Reactor HTTP Sink Connector- connect.http.request.headers enhancement #1490

Open
KevinMeng4662 opened this issue Nov 15, 2024 · 0 comments

Comments

@KevinMeng4662
Copy link

Hi Team,

There is one real use case that same Kafka topic store the events that have different Content Mode like some of events are Binary Content Mode and others are Structured Content Mode.

Binary Content Mode Events Http request example like :
`POST /someresource HTTP/1.1
Host: webhook.example.com
ce-specversion: 1.0
ce-type: com.example.someevent
ce-time: 2018-04-05T03:56:24Z
ce-id: 1234-1234-1234
ce-source: /mycontext/subcontext
.... further attributes ...
Content-Type: application/json; charset=utf-8
Content-Length: nnnn

{
... application data ...
}`

Structured Content Mode Events Http request example like :
`
PUT /myresource HTTP/1.1
Host: webhook.example.com
Content-Type: application/cloudevents+json; charset=utf-8
Content-Length: nnnn

{
"specversion" : "1.0",
"type" : "com.example.someevent",

... further attributes omitted ...

"data" : {
    ... application data ...
}

}
`

More details you can refer to :
https://github.com/cloudevents/spec/blob/v1.0.1/http-protocol-binding.md#3-http-message-mapping

Issues:
Based on above content, we can see that the headers of http request are different for different Event Content Modes.
But in the Connector Configuration of "Stream Reactor HTTP Sink Connector", the value of config item "connect.http.request.headers" is static, means have to specify https header in the connector configuration and cannot be dynamically set by different Event Content Modes.

Suggestion:
Shall we provide an enhancement for connect.http.request.headers configuration or provide new configuration item to select Kafka Event Headers as Http Headers example like:

connect.http.request.headers.filter="StreamReactor.*"

Explanation: through the wildcard character to select the Kafka headers that header keys start with "StreamReactor", these selected Kafka Headers will convert to Http Header when the Connector request to Remote Endpoint.

Or you can implment similar function as simple as you can.

Thanks

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

No branches or pull requests

1 participant