dapr / dapr/dotnet-sdk

Dapr Client, serialization and multiple clients in dependency injection

Open
#654 5 comments 0 reactions 0 assignees View on GitHub
area/client discussion
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
1d 22h
Merged PRs (30d)
5

Description

I have been dabbling with dapr lately and I am amazed how dapr makes inter service integration much easier in a micro service based architecture. I would like to ask a few questions about future plans of dapr/dotnet sdk.

1.Serialization/Deserialization
Currently, to communicate with a microservice behind dapr, dapr client in sdk is using Json serialization for some methods (InvokeMethod, PublishEvent) and protobuf serialization for others (InvokeMethodGrpc) without an option to use custom serializers. Are there any plans for dapr client in dapr/dotnet-sdk about exposing methods to implement and use custom serializers in the future that accepts and returns most primitive data types; byte[], span\ or readonlyspan\?

2.Multiple dapr clients in dependency injection
In current design, serialization and deserialization is bound to dapr client before client build operation. This includes json serialization options like camelCase in current iteration. There may be a need for multiple dapr clients to communicate with different microservices behind dapr if they are designed to use/accept different serialization options.
AddDaprClient() extension method in Dapr.AspNetCore package doesn't allow multiple dapr clients to be added to dependency injection. Even if we don't use this extension method and add multiple dapr clients with IServiceCollection.AddSingleton, I couldn't find an easy way to get desired client from IEnumerable\ collection that a class gets from dependency injection. Ability to name clients during dependency injection registry (or some other method to easily distinguish them) would be very useful.
Are there any plans to add functionality for supporting multiple dapr clients in dependency injection?

Again, I think dapr is an amazing project with so much potential. Thanks for all the hard work you put into it.

Regards,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.