Get ready to experience fast and scalable performance in your web applications as we dive into the world of Reactive Programming. Our guide using WebFlux is perfect for both beginners and experts a like.
An introduction to reactive programming concepts and basics. I aim here to show what's reactive programming, why it's used and show some frameworks and benchmarks that support it.
An introduction to reactive programming concepts and basics. I aim here to show what's reactive programming, why it's used and show some frameworks and benchmarks that support it.
Reactors.io fuses the best parts of functional reactive programming and the Actor Model. Reactors are the basic units of concurrent execution which can perform computations as well. They allow you to create concurrent and distributed applications more easily, by providing correct, robust and composable programming abstractions.
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018Scrum Breakfast Vietnam
Are you struggling to create a non-blocking REST application or a reactive micro-services? Spring WebFlux, a new module introduced by Spring 5 may help.
This new module introduces:
- Fully non-blocking
- Supports Reactive Streams back pressure
- Runs on such servers as Netty, Undertow, and Servlet 3.1+ containers
- Its support for the reactive programming model
In our next Scrum Breakfast, we will discuss Spring WebFlux, its benefit and how we implement it.
Our workshop will be including the following:
- What is reactive programming
- Introduction to Spring Webflux
- Tea break
- The details in Spring Webflux
- Reactive stack demonstration
- Q&A
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYCKonrad Malawski
Intense 3 hour workshop covering Akka Actors, Cluster, Streams, HTTP and more. Including very advanced patterns.
Presented with Henrik Engstrom at O'Reilly Software Architecture Conference in New York City in 2017
Rx is a generic abstraction of computation expressed through Observable<Element> interface, which lets you broadcast and subscribe to values and other events from an Observable stream.
Slides of a talk of a seminars series I gave at WebRatio in January 2014.
I implemented many best practices and advices in this presentation in a generic app template available here: https://github.com/iivanoo/cordovaboilerplate
Reactive programming is quite a popular topic these days. For a long time, reactive programming was constrained to interactive user interface designs. With the advancement of hardware (multi-core CPU’s) and the internet, the scale, complexity, and responsiveness of software began to rise which led to reactive programming being regarded as a major programming paradigm.
Read more from here: https://blog.lftechnology.com/introduction-to-reactive-programming-part-1-5b7c63685586
By: Subash Poudel (Software Engineer @ Leapfrog Technology, Inc.)
Mobile App Development Cost 2024 Budgeting Your Dream AppInexture Solutions
Unsure of mobile app development cost in 2024? Explore pricing trends, factors influencing costs, and expert tips to optimize your app development budget.
More Related Content
Similar to Guide to Spring Reactive Programming using WebFlux
Reactors.io fuses the best parts of functional reactive programming and the Actor Model. Reactors are the basic units of concurrent execution which can perform computations as well. They allow you to create concurrent and distributed applications more easily, by providing correct, robust and composable programming abstractions.
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018Scrum Breakfast Vietnam
Are you struggling to create a non-blocking REST application or a reactive micro-services? Spring WebFlux, a new module introduced by Spring 5 may help.
This new module introduces:
- Fully non-blocking
- Supports Reactive Streams back pressure
- Runs on such servers as Netty, Undertow, and Servlet 3.1+ containers
- Its support for the reactive programming model
In our next Scrum Breakfast, we will discuss Spring WebFlux, its benefit and how we implement it.
Our workshop will be including the following:
- What is reactive programming
- Introduction to Spring Webflux
- Tea break
- The details in Spring Webflux
- Reactive stack demonstration
- Q&A
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYCKonrad Malawski
Intense 3 hour workshop covering Akka Actors, Cluster, Streams, HTTP and more. Including very advanced patterns.
Presented with Henrik Engstrom at O'Reilly Software Architecture Conference in New York City in 2017
Rx is a generic abstraction of computation expressed through Observable<Element> interface, which lets you broadcast and subscribe to values and other events from an Observable stream.
Slides of a talk of a seminars series I gave at WebRatio in January 2014.
I implemented many best practices and advices in this presentation in a generic app template available here: https://github.com/iivanoo/cordovaboilerplate
Reactive programming is quite a popular topic these days. For a long time, reactive programming was constrained to interactive user interface designs. With the advancement of hardware (multi-core CPU’s) and the internet, the scale, complexity, and responsiveness of software began to rise which led to reactive programming being regarded as a major programming paradigm.
Read more from here: https://blog.lftechnology.com/introduction-to-reactive-programming-part-1-5b7c63685586
By: Subash Poudel (Software Engineer @ Leapfrog Technology, Inc.)
Mobile App Development Cost 2024 Budgeting Your Dream AppInexture Solutions
Unsure of mobile app development cost in 2024? Explore pricing trends, factors influencing costs, and expert tips to optimize your app development budget.
Explore data serialization in Python with a comparison of JSON and Pickle. Discover their differences in human-readability, security, interoperability, and use cases.
Best EV Charging App 2024 A Tutorial on Building Your OwnInexture Solutions
Discover stations, track usage, and gain complete control over your electric vehicle charging experience. This 2024 tutorial empowers you to build your own feature-rich EV charging app.
What is a WebSocket? Real-Time Communication in ApplicationsInexture Solutions
Want to build dynamic applications? Learn how WebSockets enable real-time communication in applications. Up your development game with this insightful guide.
Navigate the complexities of SaaS with confidence. Learn how to streamline your SaaS Application development with a step-by-step guide. Build successful applications faster!
Discover top-rated SharePoint migration tools for a seamless transition. Explore streamline data transfer and enhanced functionalities to optimize your business move.
Learn Spring Boot with Microsoft Azure Integration. Discover tutorials, guides & best practices for deploying your Spring Boot apps on Azure. Boost scalability & efficiency.
Boost content efficiency & personalize interaction with AEM's best features. Lean how AEM enhances web content management, digital asset management, personalization, and seamless integration.
Master your React development expertise with our tutorial on integrating React Router Dom. Gain hands-on insights, step-by-step guidance, and empower your skills to create efficient and responsive navigation in React applications.
Explore the landscape of Mobile Banking App Cost, Our detailed guide delves into the factors influencing pricing, latest trends, and essential features.
Micronaut Framework Guide Framework Basics and Fundamentals.pdfInexture Solutions
Discover the power of the Micronaut Framework for building fast, lightweight, and scalable Java applications. Learn how Micronaut's innovative features streamline development and boost performance. Dive into Micronaut today for next-level Java development efficiency.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
Guide to Spring Reactive Programming using WebFlux
1. Guide to Spring Reactive Programming using
WebFlux
Reactive programming is a programming paradigm that promotes an asynchronous,
non-blocking, event driven approach to data processing. Reactive programming
involves modelling data and events as observable data streams and implementing
data processing routines to react to the changes in those streams.
In the reactive style of programming, we make a request for the resource and start
performing other things. When the data is available, we get the notification along
with the data in the form of call back function. In the callback function, we handle
the response as per application /user needs.
Features of Reactive Programming
• Asynchronous & Non-blocking
• Functional style of coding
2. • Data flow as event driven stream
• Backpressure on data streams
When considering whether to use Spring MVC or Spring WebFlux, there are various
factors you must consider.
Spring MVC: It’s based on a servlet API and follows an imperative programming
model. This means you write code in a step-by-step manner, which is generally easier
to follow.
Spring WebFlux: It offers a reactive programming model. Reactive programming is
about handling asynchronous streams of data. This requires a change in thinking and
can be more challenging than the traditional imperative model.
Spring MVC: If you are familiar with traditional web application development, Spring
MVC’s imperative model might seem more straightforward. It’s easier to read, write,
and understand for developers accustomed to this approach.
Spring WebFlux: Writing reactive code can initially seem complex because of the
shift in mindset. However, for some use cases, like streaming data, it can simplify
your code.
Spring MVC: Debugging is typically more straightforward with an imperative model
because the call stacks are more predictable and easier to trace.
3. Spring WebFlux: Debugging reactive streams can be tricky, especially for developers
new to the reactive paradigm. However, tools and practices are evolving to better
support this.
Spring MVC: Works naturally with blocking resources like traditional RDBMS using
JDBC or JPA (Java Persistence API).
Spring WebFlux: If you have blocking dependencies like traditional databases, you
might not get the full benefits of the reactive model. However, reactive databases
like MongoDB Reactive, Cassandra Reactive, etc., can be integrated natively with
WebFlux.
Spring MVC: Uses a thread-per-request model. For a high number of simultaneous
connections, this can lead to a large number of threads, which may not be efficient.
Spring WebFlux: Uses an event-loop concurrency model, which can handle a vast
number of simultaneous connections with a smaller number of threads. It’s designed
for high concurrency.
Spring MVC: Typically runs on servlet containers like Tomcat, Jetty, etc.
Spring WebFlux: Runs on reactive runtimes like Netty. This provides non-blocking
and highly scalable operations, suitable for high-performance systems.
Spring MVC: Typically uses annotated controllers.
Spring WebFlux: In addition to annotated controllers, WebFlux supports functional
endpoints which allow for programmatic route definitions.
Spring WebFlux:
As we know, Spring provides Web MVC framework to handle the HTTP requests, but
it is Blocking & Non-Reactive in nature, so to support reactive programming Spring
provides one more web framework in Spring 5 (includes in Spring Boot 2.0) called
WebFlux.
4. It is a reactive-stack web framework that is fully non-blocking, supports reactive
streams back pressure. It uses project Reactor as a reactive library. The Reactor is a
Reactive Streams Library and therefore, all of its operators support non-blocking
back pressure.
It uses two publishers:
• Mono
• Flux
MONO:
A mono is a specialized Publisher that emits at most one item and then optionally
terminates with an onComplete signal or an onError signal. In short, it returns 0 or 1
element.
• Mono is another implementation of Publisher.
• It emits at most one item and then (optionally) terminates with an
onComplete signal or an onError signal.
• Like Flux, Mono is also asynchronous in nature.
Mono noData = Mono.empty();
Mono data = Mono.just(“rishi”);
FLUX:
A flux is a standard Publisher representing an asynchronous sequence of 0 to N
emitted items, optionally terminated by either a completion signal or an error. These
three types of signals translate to calls to a downstream subscriber’s onNext,
onComplete, or onError methods.
• Flux is an implementation of Publisher.
• It will emit 0 to N elements and/or a complete or an error call.
• Stream pipeline is synchronous whereas Flux pipeline is completely
asynchronous. It will emit values only when there is a downstream subscriber.
To subscribe, we need to call the subscribe method on Flux. There are different
variants of the subscribe method available, which we need to use as per the need:
Flux flux1 = Flux.just(“foo”, “bar”, “foobar”);
5. Flux flux2 = Flux.fromIterable(Arrays.asList(“A”, “B”, “C”));
Flux flux3 = Flux.range(5, 3);
// subscribe
flux.subscribe();
Frequently used operations on Mono/Flux
• just(-): Create a new Mono that emits the specified item, which is captured at
instantiation time.
• fromArray(-): Create a Flux that emits the items contained in the provided
array.
• fromIterable(-): Create a Flux that emits the items contained in the provided
iterable. The Iterable.iterator() method will be invoked at least once and at
most twice for each subscriber.
• fromStream(-): Create a Flux that emits the items contained in a Stream
created by the provided Supplier for each subscription. The Stream is closed
automatically by the operator on cancellation, error, or completion.
• empty(): Create a Flux that completes without emitting any item.
• doOnNext(-): Add behaviour (side-effect) triggered when the Flux emits an
item.
• doOnComplete(-): Add behaviour (side-effect) triggered when the Flux
completes successfully.
• doOnError(-): Add behaviour (side-effect) triggered when the Flux completes
with an error.
• map(-): Transform the items emitted by this Flux by applying a synchronous
function to each item.
• flatMap(-): Transform the item emitted by this Mono asynchronously,
returning the value emitted by another Mono (possibly changing the value
type).
• subscribe(-, -, -): Subscribe a Consumer to this Flux that will consume all the
elements in the sequence. It will request an unbounded demand.
• log(): Observe all Reactive Streams signals and trace them using Logger
support. Default will use Level.INFO and java.util.logging. If SLF4J is available,
it will be used instead.
6. • delayElements(-): Delay each of this Flux elements (Subscriber.onNext signals)
by a given Duration. Signals are delayed and continue the parallel default
Scheduler, but empty sequences or immediate error signals are not delayed.
• block(): Subscribe to this Mono and block indefinitely until a next signal is
received. Returns that value, or null if the Mono completes empty. In case the
Mono errors, the original exception is thrown (wrapped in a RuntimeException
if it was a checked exception)
Working with Spring Web Flux –
Understanding the Reactive nature
Requirement: Send Promos to all the customers of an e-Commerce website
Step-1: Create a Spring Boot project using Maven (Choose Spring Boot version 2.0 or
later)
Step-2: Add the below spring-boot-starter-webflux dependency in pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
This dependency includes the below dependencies
• spring-webflux framework
• reactor-core that we need for reactive streams
reactor-netty (the default server that supports reactive streams). Any other servlet
3.1+ containers like Tomcat, Jetty or non-servlet containers like Undertow can be
used as well
Version will be picked from spring-boot-starter-parent dependency version
Step-3: Create a Customer DTO class with the fields Id, Name & Email Id
7. Step-4: Create a Customer Repo with 2 functions loadCustomers(),
loadCustomerStream() as in the below snapshot.
8. Step-5: Create a Customer Service with 2 functions, one is to send promos to list of
customers, another is to send promos to customer stream
9. Step-6: Create a Customer REST Controller with 2 end points as in the below
screenshot
Summary:
Spring introduced a Multi-Event Loop model to enable a reactive stack known as
WebFlux. It is a fully non-blocking and annotation-based web framework built on
Project Reactor which allows building reactive web applications on the HTTP layer. It
provides support for popular inbuilt severs like Netty, Undertow, and Servlet 3.1
containers.
WebFlux is also relevant for applications that need scalability or to stream request
data in real time. While implementing a micro-service in WebFlux we must consider
that the entire flow uses reactive and asynchronous programming and none of the
operations are blocking in nature.
Originally published by: Guide to Spring Reactive Programming using WebFlux