Messaging: PayloadMethodArgumentResolver should call certain Decoders even if the message is empty #29898
Labels
in: messaging
Issues in messaging modules (jms, messaging)
status: superseded
An issue that has been superseded by another
type: enhancement
A general enhancement
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:
My MessageHandler is then defined like this:
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?
The text was updated successfully, but these errors were encountered: