cloudevents / cloudevents/sdk-java

Spring CloudEventMessageConverter content-type header name

Aperta
#680 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Java
Stelle
446
Fork
172
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Individua il codice di Spring CloudEventMessageConverter in sdk-spring e verifica come legge gli header content-type. Verifica l’interazione tra serializzatore e deserializzatore descritta nell’issue, quindi mantieni i fallback esistenti supportando al contempo il nome dell’header della specifica CloudEvents; il lavoro è completato quando i messaggi strutturati da sdk-kafka vengono deserializzati tramite sdk-spring.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, kafka, spring
Ambito
backend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.