-
Notifications
You must be signed in to change notification settings - Fork 301
Cannot convert from [[B] to [com.example.DummyMessage] for GenericMessage #1147
Comments
When I hardcoded this in dependencyManagement it works and also send message outside but I afraid of imcompatible issues.
I debuged it. When using vesrion 3.0.1 the AvroSchemaRegistryClientMessageConverter has injected OriginalContentTypeResolver, but 3.0.2 has DefaultContentTypeResolver OriginalContentTypeResolver was originally set into AvroSchemaRegistryClientMessageConverter during avro auto configuration, but later reset to DefaultContentTypeResolver in CompositeMessageConverterFactory class The class where this happened and is different between versions and it names ContentTypeConfiguration.
Can somebody explain why this was changed there? |
I have this as workaround solution working for me. But I don't know if its OK. Can somebody confirm that some problems can occur?
|
this commit replacing resolver also for all custom converters with default one: @olegz Why this was changed? If I good understood, Im not able to define custom converter with custom contentType resolver now? |
@metalpalo Could you create a small reproducible sample and share that with us? Thank you! |
@metalpalo Closing the issue now. Feel free to re-open with a reproducible sample if you are still facing issues with this. |
Sorry for late answer, I was very busy. But question was simple. Why you reset contentType resolver on custom converters? But in commit mentioned above it was reset to DefaultContentTypeResolver. |
@metalpalo Could you point which commit made that change? It's not clear where that change is made, also where do you see |
@sobychacko I use AvroSchemaRegistryClientMessageConverter from library, verrsion 1.0.13.RELEASE:
Ancestor of this class, namely AbstractAvroMessageConverter, implicitly sets OriginalContentTypeResolver as contenType resolver:
This converter was recognized like custom one his resolver was replaced with DefaultContentTypeResolver via class CompositeMessageConverterFactory where first parameter is list of custom converters. |
I cannot locate the class |
@metalpalo as Soby suggested several times, please provide a reproducible sample. |
I created sample of springboot application based on This application does nothing special, just logs assigned content type resolvers for founded message converter. logs from SR1 are following:
logs from SR2 are following:
So SR2 replace implicit content type resolver with default one. Everything is done in mentioned class ContentTypeConfiguration: AvroSchemaRegistryClientMessageConverter@63cd2cd2 -> OriginalContentTypeResolver@44aa2e13 I think this will have impact also on another custom message converters. |
@metalpalo Thanks for the sample. Why are you using a very old version of spring-cloud here? Even in the Here are my suggestions. Update to the latest Do you have a strong reason to use Here is a sample that demonstrates SCSt + Confluent Schema Registry + AVRO: https://github.com/spring-cloud/spring-cloud-stream-samples/tree/main/schema-registry-samples/schema-registry-confluent-avro-serializer Please update how you want to proceed with this issue so that we can close it or take further actions. Thanks! |
@sobychacko I used last Hoxton version for this moment, namely SR12 and same problem. I just wanted to illustrate where/when the problem started, that means changes between SR1 ->SR2. Regarding your suggested upgrades to newer SCS, using avro serializers from Kafka/Confluent and so on... But in summary, I wanted to focus on general problem. What if somebody implement custom message converter with own resolver and releases >= SR2 will override it to default one? Thanks |
Describe the issue
After upgrade from spring-cloud-starter-parent from Hoxton.SR1 to Hoxton.SR2 we received following error when consuming kafka messages avro encoded from legacy microservices used springboot 1.5.x:
The message paylods on kafka had wrapped avro contentType withing application/octet-stream:
contentType="application/octet-stream" originalContentType="application/vnd.dummymessage.v1+avro"
Both producer and consumer service has set embeddedHeaders as headerMode.
To Reproduce
Steps to reproduce the behavior:
Version of the framework
spring-cloud-starter-parent:Hoxton.SR2
spring-boot-starter-parent: 2.2.4.RELEASE
spring-cloud-stream-binder-kafka: 3.0.2.RELEASE
Expected behavior
Kafka message should be successfully processed as for following configuration:
spring-cloud-starter-parent:Hoxton.SR1
spring-boot-starter-parent: 2.2.2.RELEASE
spring-cloud-stream-binder-kafka: 3.0.1.RELEASE
Can somebody tell me what change there? Does exist some configuration for backward compatibility?
thanks
brmetalpalo
The text was updated successfully, but these errors were encountered: