Get Started with Reactive Programming in Spring

Get Started with Reactive Programming in Spring

Reactive programming is an approach to writing software that embraces asynchronous I/O. It’s pretty awesome.

Simone Di Cola

Nice article. Well done!

edward wu

Hi,
In the method read of Asynchronous, the while block seems wrong, since fileChannel.read invoked in completed method.

amatureandroiduser

Would have been great to see same example written in reactive program

Matt Raible

The next post in this series has code: Build Reactive APIs with Spring WebFlux.

amatureandroiduser

Thanks for sharing the next post. May be i should have been more clear, this post explains file read and serving it over network as non-reactive example.
1. how would be the same code in reactive programming
2. how would it respond when server is loaded with lot of request, may be unit/integration test to explain that
3. file read is synchronous blocking io operation, multiple concurrent requests for same file or different file, how would reactive programming handle that
4. how would the client be designed to access this async way of file read

Matt Raible

Thanks for your suggestions. I’ll keep them in mind for my next post on reactive programming.

amatureandroiduser

Appreciate your help. Your posts are very helpful. Please do share more

Deep Mahajan

Hi,
Anyone of you please let me know how we can emit/push flux using Sinks.Many.unicastspec ?I tried unicastSpecs.backpressure().tryEMitNext(10) but it seems like it is not working.Please some one provide example of it that would be great help.

Matt Raible

I would suggest posting this question to Stack Overflow and tagging it with “webflux”.

Nishant Malhotra

Hi Matt,

Very nice article explaining reactive programming and how in form of Spring webflux we got a framework that wrap around Reactor API . I am very new to reactive and microservices as well . Can you please guide any real time example where multiple services created in Spring boot , registered with Spring cloud Registry and has Spring cloud gateway configured as proxy communicating with each other in form of events using reactive programming . If yes that will be really helpful for me to relate where actually reactive fits in.

Matt Raible

Yes, you can see my Reactive Java Microservices with Spring Boot and JHipster post for an example. You can also navigate directly to its GitHub repo.

Nishant Malhotra

Thanks Matt