Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messaging: PayloadMethodArgumentResolver should call certain Decoders even if the message is empty #29898

Closed
spheenik opened this issue Jan 30, 2023 · 2 comments · May be fixed by #29903
Closed
Labels
in: messaging Issues in messaging modules (jms, messaging) status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@spheenik
Copy link

spheenik commented Jan 30, 2023

Affects: Spring-Messaging 6.0.3

I am currently implementing an application, that uses Protobuf over RSocket for communication.
In Protobuf, I can define a message sent to my application like this:

message ProductsRequest {
  optional string id = 1;
}

My MessageHandler is then defined like this:

@MessageMapping("products")
public Mono<ProductsResponse> handle(ProductsRequest request) {
    // implementaion
}

The request may contain an id, but it may be omitted.
In case the id is omitted, the message is encoded as an empty buffer (as per Protobuf spec).

However, in the class org.springframework.messaging.handler.annotation.reactive.PayloadMethodArgumentResolver, empty buffers are never passed to the decoder, and instead immediately filtered out. (via .filter(this::nonEmptyDataBuffer), which then results in an error because the MessageHandler's argument cannot be resolved.

I understand that this behavior is reasonable for a lot of decoders, however in the case of Protobuf is a nuisance.

I think the best way to implement this is to add a property to the decoder ("can decode empty") and then filter or not, based on this property. I would gladly spend some time on this and come up with a pull request, but I wanted to have some guidance first, to not sent a crappy pull request.

So, roughly, how should this be implemented?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 30, 2023
@spheenik spheenik changed the title Messaging: PayloadMethodArgumentResolver Should call certain Decoders even if the message is empty Messaging: PayloadMethodArgumentResolver should call certain Decoders even if the message is empty Jan 30, 2023
@poutsma poutsma added the in: messaging Issues in messaging modules (jms, messaging) label Jan 31, 2023
@simonbasle simonbasle added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 6, 2023
@simonbasle
Copy link
Contributor

Superseded by #29903

@simonbasle simonbasle closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2023
@simonbasle
Copy link
Contributor

(let's continue the conversation in the PR)

@sbrannen sbrannen added the status: superseded An issue that has been superseded by another label Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants