spring-cloud / spring-cloud/spring-cloud-stream

Consider Adding a ConversionService to HeaderMethodArgumentResolver

Open
#1,833 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
646
Avg merge
2d 3h
Merged PRs (30d)
8

Description

This might belong in core Spring Framework, but see https://stackoverflow.com/questions/58568209/how-can-i-map-incoming-headers-as-string-instead-of-byte-in-my-spring-cloud-st/58571153#58571153

Kafka headers are byte[]. If the source is a Spring app, the default header mapper supplies type information so String headers are rendered as such by the header mapper.

If the source is a "foreign" app, there is no type information and the headers are presented to the listener method as byte[]. Users have to configure a custom header mapper to work around this.

A conversion service could perform simple conversions to target parameter types.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with HeaderMethodArgumentResolver and read the linked Stack Overflow discussion, then trace how Kafka byte[] headers reach listener method parameters and how existing header mapping supplies type information. Done means simple conversions from foreign-app headers to target parameter types are supported and the behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka, spring
Domain
api, backend, stream-processing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.