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

Spring CloudEventMessageConverter content-type header name #680

Open
gustavomonarin opened this issue Nov 4, 2024 · 0 comments
Open

Spring CloudEventMessageConverter content-type header name #680

gustavomonarin opened this issue Nov 4, 2024 · 0 comments

Comments

@gustavomonarin
Copy link

gustavomonarin commented Nov 4, 2024

Spring CloudEventMessageConverter content-type header name uses the Spring Messaging contentType header name which differs fom the cloud events spec content-type which is used by Kafka serializer for instance.

This leads to a message from a project using structured mode and kafka serializer (sdk-kafka) to not be deserialized by another project using (sdk-spring).

The current code is as follows on sdk-spring:

        if (message.containsKey(MessageHeaders.CONTENT_TYPE)) {
            return String.valueOf(message.get(MessageHeaders.CONTENT_TYPE));
        }
        if (message.containsKey(CloudEventsHeaders.CONTENT_TYPE)) {
            return String.valueOf(message.get(CloudEventsHeaders.CONTENT_TYPE));
        }

Unfortunately the CloudEventsHeaders.CONTENT_TYPE is CE_PREFIX + "datacontenttype" which is not exactly the same property we are looking here.

I would be happy to create a merge request where a another fallback is introduced to have the spec header name (content-type) which would enable the sdk-spring to deserialize messages.

This would add the support while still keeping it compatible with different versions and services.

Ideally, also the spring-sdk serializer should be checked and changed, but i would rather have this small mr fixed and dive on the serializer in a different issue.

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