dapr / dapr/java-sdk

Support taking an ObjectSerializer as well on pubsub message handling

Open
#597 3 comments 2 reactions 0 assignees View on GitHub
area/spring kind/enhancement P2 size/S triaged/resolved
Dominant language
Java
Stars
300
Forks
230
Avg merge
1d 20h
Merged PRs (30d)
4

Description

## Describe the proposal

Porting a suggestion from user bencod#6730 in Dapr Discord:

> On publishing, Dapr client accepts message data as Object and it serialize the Object using ObjectSerializer - the Dapr one or user provided one.
>
> On message handling user receives a CloudEvent that has data which according to documentation is String or Json, or the binary data of the message.
>
> It requires user to deserialize the message. This behavior is not consistent with publishing serialization which is done by client.
> I would expect deserialization to be done by infra as well, to allow user to provide an ObjectSerializer and CloudEvent to be typed. Something as follows:
>
> ```java
> @Topic(name = "testTopic", pubsubName = "testPubSub", serializer = MyMsgObjectSerializer.class)
> public Mono handleMessage(@RequestBody(required = false) CloudEvent cloudEvent) {
> ...
> }
> ```

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.