spring-cloud-stream icon indicating copy to clipboard operation
spring-cloud-stream copied to clipboard

Consider Adding a ConversionService to HeaderMethodArgumentResolver

Open garyrussell opened this issue 5 years ago • 0 comments

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.

garyrussell avatar Oct 26 '19 21:10 garyrussell