Skip to content

feat(serialization): add serialization based on specific header value#4

Open
harry-detsis wants to merge 2 commits intosadesyllas:developfrom
harry-detsis:header-type-serialization
Open

feat(serialization): add serialization based on specific header value#4
harry-detsis wants to merge 2 commits intosadesyllas:developfrom
harry-detsis:header-type-serialization

Conversation

@harry-detsis
Copy link
Copy Markdown
Contributor

This MR adds a new serialization strategy that allows the serialization/deserialization of messages based on the presence and value of a specific header. This is to allow consumers to consume messages that do not have their message types set to the name of the assembly of the serialization/deserialization target.

To use this functionality, simply register a producer or consumer as follows:

new RabbitMqServiceBuilder<MyConusmer>()
    .WithRabbitMqConfig(rabbitMqConsumerConfiguration)
    .WithHeaderTypedMessages(new HeaderTypeSerializationConfiguration
    {
        TypeHeader = "x-my-header",
        TypeMappings = new Dictionary<string, Type>
        {
            {"my.type", typeof(MyType)}
        }
    })
    .Build(_serviceCollection)
    .Add(_serviceCollection, typeof(MyConusmer));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant