Provide streaming API endpoint as event-stream or ndjson?

111
June 29, 2022, at 06:50 AM
@GetMapping(value = "/export", produces = {"text/event-stream", "application/x-ndjson"})
public Flux<Object> getExport() {
    //...
}

Spring offers at least 2 possibilities to provide a streaming api response, which are very similar.

When creating a new api: should one prefer event-stream like:

data: {"key": "value"}
data: {"key": "value"}
data: {"key": "value"}

Or ndjson:

{"key": "value"}
{"key": "value"}
{"key": "value"}

What's better from client developers point of view, also regarding future compatibility?

Rent Charter Buses Company
READ ALSO
Maximum sum in array given constraints

Maximum sum in array given constraints

Given an array of positive integers, return the maximum sum

88
How can I remove a parameter from a subclass constructor in Java?

How can I remove a parameter from a subclass constructor in Java?

In my superclass, I have defined the parameters a, b, c and dFor its subclass, I want to remove d

77
Problem with concurrent sessions and OAuth2 in Spring Boot

Problem with concurrent sessions and OAuth2 in Spring Boot

I'm working with Spring Security 56

105
Pass html data to Quarkus Template

Pass html data to Quarkus Template

I am using Quarkus Mailer and Quarkus Template to create an endpoint that will be responsible just for sending emailsFor now it just receives the subject, body and the emails that the email should be sent to

98