Skip to content

Random behavior in DelegatingByTypeSerializer based on type of delegates map #3953

Closed
@MaheshAravindV

Description

@MaheshAravindV

In what version(s) of Spring for Apache Kafka are you seeing this issue?

3.3.6

Describe the bug

When creating a DelegatingByTypeSerializer with assignable = true, if one of the types in the input map is a child of another type, the serializer that gets picked is random.

To Reproduce

  1. Create a DelegatingByTypeSerializer with assignable = true
  2. Have one type in the input map as the child of another type
  3. When a message of the child type is send, the actual serializer used is random if the map used to create the serializer does not enforce order. This is because the contract does not enforce people to use a SequencedMap.

Expected behavior

The order in which the serializer is picked for a type if there are multiple available should be deterministic.

Sample

https://github.com/MaheshAravindV/spring-kafka-delegating-serializer-sample

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions