• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Webflux and REST Api

 
Bartender
Posts: 1314
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm playing a bit with WebFlux and Spring 5 just to get acquainted with reactive paradigm... it's something I'm not used to use, I think it will take a fairly amount of time to be really mastered.
My first question: I developed a REST endpoint using Flux and FluxSink to dinamically generate data to be sent to the client. I developed the endpoint so that a random amount of time elapses between two subsequent calls of fluxsink.next(item) method.
As expected, if i issue a GET on the enpoint via CURL, I see that JSON entities are "streamed"  as soon as they're created in the flux; I'd like to get the same effect via PostMan, but at the moment I've only been able to get all the data all together, when the fluxsing.complete() method is invoked.
REST endpoint is declared to produce an 'application/x-ndjson' mime type.
Any suggestion ?
TIA
 
Marshal
Posts: 3655
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was an issue opened almost 4 years ago regarding streaming result support in Postman (specifically SSE) - looks like it still has not been addressed.
 
Ron McLeod
Marshal
Posts: 3655
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never heard of application/x-ndjson (newline-delimited JSON) before - it is something specific to Spring?

For streaming, I would normally use SSE or WebSockets to a browser, or gRPC (HTTP/2) to stream between services.
 
Claude Moore
Bartender
Posts: 1314
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:I've never heard of application/x-ndjson (newline-delimited JSON) before - it is something specific to Spring?



I dont' think it's spring-specific, but to be honest I've also never heard of it before.

Ron McLeod wrote:For streaming, I would normally use SSE or WebSockets to a browser, or gRPC (HTTP/2) to stream between services.



Yes, I also used to use websockets. I'm just doing some experiments with webflux. This is a code snipped of which I've done so far :



Please note that I'm not even sure if in a Rest Api we could use streaming. On the opposite, I'm afraid that, even if a similar approach will work, it would be against any REST principle.

Here Customer is a simple bean, irrelevant with respect the specific use case (it's just a plain bean). I would expect to get a bean every 1 second, but as I described above, I can only get the whole bunch of 10 customers.

Ron McLeod wrote:
There was an issue opened almost 4 years ago regarding streaming result support in Postman (specifically SSE) - looks like it still has not been addressed.



At the moment I tried also Google ARC (advanced rest client),  with no better luck; honestly I didn't investigate ARC further, normally I use Postman even for work and I'd prefer keep focused on a single testing tool.



 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic