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

Payload empty after conversion happens #1114

Closed
dimuthu-abeynayakage-sportsbet opened this issue Feb 26, 2024 · 3 comments
Closed

Payload empty after conversion happens #1114

dimuthu-abeynayakage-sportsbet opened this issue Feb 26, 2024 · 3 comments

Comments

@dimuthu-abeynayakage-sportsbet
Copy link

I have a situation where the payload gets empty when the message under went the conversion.
Note: The payload comes as a List
Payload:
[payload=[{"recordHeader": {"producerId": "67bef361-8d47-497a-b670-cf7839e2b4a1", "producedAt": {"epoch_millis": 1707716860875}, "correlationId": "11"}, "customer": {"id": "12345", "memberCustomerId": null}}], headers={kafka_offset=[1304], kafka_conversionFailures=[], kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@51e0350c, kafka_timestampType=[CREATE_TIME], kafka_receivedPartitionId=[4], kafka_receivedMessageKey=[8012008], kafka_batchConvertedHeaders=[{X-Custom-Header=[B@3d914a96}], kafka_receivedTopic=[topic1], kafka_receivedTimestamp=[1707716860875], contentType=application/*+avro, kafka_groupId=local-group}]

The message gets deserialised and comes to the
SimpleFunctionRegistry.java#L1356

it goes to
SmartCompositeMessageConverter.java#L84

which returns an empty list when no converter found.

Falling back to
SimpleFunctionRegistry.java#L136

it checks just convertedInput == null . however, not if the list is empty hence the payload to be removed form the message when coming to the consumer

Im using
Spring boot: 3.1.8
spring-cloud-function-context: 4.1.0

@olegz
Copy link
Contributor

olegz commented Mar 27, 2024

In Spring Messaging payload of null is not allowed. In other words we can never have payload as null, hence the null check.

It is not quite clear from your issue if what you expected is a null payload, but if you did here is your answer. And if so what is the problem with empty list? You can do a check inside the function and act etc. . .

@carolmorneau
Copy link

This sounds like the same issue as: #1112
You might want to check the 2 workarounds described on that issue and see whether they can be applied for your use case.

@olegz
Copy link
Contributor

olegz commented May 30, 2024

Closing it due to inactivity from the original reporter and answer from the community mamber

@olegz olegz closed this as completed May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants