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

CloudEventHttpMessageConverter can't convert List<CloudEvent> #659

Open
capmorganbih opened this issue Jul 10, 2024 · 2 comments
Open

CloudEventHttpMessageConverter can't convert List<CloudEvent> #659

capmorganbih opened this issue Jul 10, 2024 · 2 comments

Comments

@capmorganbih
Copy link

capmorganbih commented Jul 10, 2024

I’m trying to add an endpoint to my Spring app for batch ingestion of CloudEvents, but CloudEventHttpMessageConverter isn’t playing nice. It won’t convert to List.

What I Did
Built a Spring Boot app.
Added a REST endpoint to accept a batch of CloudEvents.
Set up CloudEventHttpMessageConverter for the conversion.
Sent a batch of CloudEvents to the endpoint.

What I Expected
I expected the converter to turn the HTTP request into a List.

What’s Actually Happening
It’s not working. The converter is failing and throwing an error instead of doing the conversion.

@RestController
public class CloudEventController {

    @PostMapping("/ingest")
    public ResponseEntity<String> ingestBatch(@RequestBody List<CloudEvent> events) {
        // Processing logic
        return ResponseEntity.ok("Batch ingested successfully");
    }
}
@beyond007jj
Copy link

I've encountered the same issue. Have you resolved it?

@capmorganbih
Copy link
Author

@beyond007jj it's not supported by the SDK. The best you can do is implement your own spring converter for json + batch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants