Open michalstefanext opened 2 years ago
@michalstefanext This is a validation in Spring Integration itself org.springframework.integration.support.MessageBuilder
. I'm not sure why they prevent null
s for the message payload.
cc/ @artembilan
See here for more info: https://jira.spring.io/projects/INT/issues/INT-997
But generally speaking the null
payload was never supported: no data - no message.
So, yo need to consider some rework in the PubSubInboundChannelAdapter
to prevent such a null to be emitted or some other wrapper object, like we have with KafkaNull
as a tombstone signal to send and receive null
from Apache Kafka.
That's for now until we really introduce an Optional
wrapper support in Spring Integration.
Thanks @artembilan! It seems that something like a PubSubNull
would be the way to go. It will require some changes to PubSubInboundChannelAdapter
and our message conversion logic to ensure that PubSubNull
is converted to null
when needed.
We'll accept it as a feature request.
@emmileaf Take a look at this issue -- it's in the Spring Integration layer of Pub/Sub support.
@michalstefanext Do you happen to remember what was the type of the empty payload (string, byte array, etc.) passed to the PubSubInboundChannelAdapter
, and whether it went through any custom conversions or transformations?
I am having some difficulty reproducing the exception: directly receiving a pubsub message with empty body seems to be handled as expected (as empty strings and empty byte arrays), and not resulting in null
as the Spring message payload.
Hello, I would like to ask, if there is any possibility to receive message with empty payload via PubSubInboundChannelAdapter? It seems to me that this is impossible, however that is perfectly valid scenario in gcp pubsub.