Skip to content

Avoid using default type mapper in producer extensions #371

@alexeyzimarev

Description

@alexeyzimarev

After moving the type mapper to be an interface, a custom mapper can be used almost everywhere.

The only place where the default static type mapper instance is used is producer extensions. Those extensions are useful as they hide serialisation boilerplate, but there's an issue with having MessageType in ProducedMessage record. The property is used by BaseProducer for diagnostics, but the actual message type used in produce actions is provided by the serialiser. Therefore, there is a chance of using different message types in diagnostics and in the actual produced message, which can lead to issues when finding issues in production.

The solution would be:

  • Serialisation is handled by BaseProducer
  • ProducedMessage record would not have MessageType property
  • Split ProducedMessage (input) and internal produced message (serialised payload and event type)
  • Move serialisation upstream

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions