Vert.x in Action
Asynchronous and Reactive Java
Julien Ponge
  • MEAP began October 2018
  • Publication in December 2020 (estimated)
  • ISBN 9781617295621
  • 328 pages (estimated)
  • printed in black & white

A fantastic introduction into Vert.x written for developers looking to develop services more efficiently in terms of time and resources.

Andrew Buttery
As enterprise applications become larger and more distributed, new architectural approaches like reactive designs, microservices, and event streams are required knowledge. The Vert.x framework provides a mature, rock-solid toolkit for building reactive applications using Java, Kotlin, or Scala. Vert.x in Action teaches you to build responsive, resilient, and scalable JVM applications with Vert.x using well-established reactive design patterns.

About the Technology

Vert.x is a mature framework for building reactive applications on the JVM. Designed to handle asynchronous communication effortlessly, Vert.x permits the fewest number of concurrent threads possible. As a result, you automatically get increased scalability, resource efficiency, and dependability, which are big wins for any distributed system. Vert.x’s modular design lends itself perfectly to data processing, IoT gateways, web apps, gaming backends, and more.

Vert.x supports all major JVM languages and asynchronous programming models including callbacks, promises, Scala futures, and Kotlin futures. Hosted by the Eclipse foundation and now in its third major release, Vert.x boasts over seven years of field-tested performance. In addition, Vert.x has been integrated into the Red Hat OpenShift platform as a rapid development tool for cloud native reactive applications.

About the book

Vert.x in Action teaches you to build highly-scalable reactive enterprise applications. In this practical developer’s guide, Vert.x expert Julien Ponge gets you up to speed in the basics of asynchronous programming as you learn to design and code reactive applications. Using the Vert.x asynchronous APIs, you’ll build services including web stack, messaging, authentication, and access control. You’ll also dive into deployment of container-native components with Docker, Kubernetes, and OpenShift. Along the way, you’ll check your app’s health and learn to test its resilience to external service failures.

As a member of the Vert.x core team, Julien Ponge has up-close-and-personal experience you can trust. The lessons and examples in this book center on principles that will easily transfer to other reactive technologies, empowering you to apply what you learn using Vert.x or the reactive tech of your choice. With the rising tide of microservices and distributed systems, reactive programming is flowing into the mainstream. With Vert.x in Action, you’ll be sailing smoothly!

Table of Contents detailed table of contents

Part 1: Fundamentals of asynchronous programming with Vert.x

1 Vert.x, asynchronous programming, and reactive systems

1.1 Being distributed and networked is the norm

1.2 Not living on an isolated island

1.3 There is no free lunch on the network

1.4 The simplicity of blocking APIs

1.5 Blocking APIs waste resources, increase costs

1.6 Asynchronous programming with non-blocking I/O

1.7 Multiplexing event-driven processing: the case of the event loop

1.8 What is a reactive system?

1.9 What else does reactive mean?

1.10 What is Vert.x?

1.11 Your first Vert.x application

1.11.1 Preparing the project

1.11.2 The VertxEcho class

1.11.3 The role of callbacks

1.11.4 So is this a reactive application?

1.12 What are the alternatives to Vert.x?

1.13 Summary

2 Verticles: the basic processing units of Vert.x

2.1 Writing a verticle

2.1.1 Preparing the project

2.1.2 The verticle class

2.1.3 Running and first observations

2.2 More on verticles

2.2.1 Blocking and the event loop

2.2.2 Asynchronous notification of life-cycle events

2.2.3 Deploying verticles

2.2.4 Passing configuration data

2.3 When code needs to block

2.3.1 Worker verticles

2.3.2 The executeBlocking operation

2.4 So what is really in a verticle?

2.4.1 Verticles and their environment

2.4.2 More on contexts

2.4.3 Bridging Vert.x and non-Vert.x threading models

2.5 Summary

3 Event bus: the backbone of a Vert.x application

3.1 What is the event bus?

3.1.1 Is the event bus just another message broker?

3.1.2 Point-to-point messaging

3.1.3 Request-reply messaging

3.1.4 Publish/subscribe messaging

3.2 The event bus in an example

3.2.1 Heat sensor verticle

3.2.2 Listener verticle

3.2.3 Sensor data verticle

3.2.4 HTTP server verticle

3.2.5 Bootstrapping the application

3.3 Clustering and the distributed event bus

3.3.1 Clustering in Vert.x

3.3.2 From event bus to distributed event bus

3.4 Summary

4 Asynchronous data and event streams

4.1 Unified stream model

4.2 What is back-pressure?

4.3 Making a music-streaming jukebox

4.3.1 Features and usage

4.3.2 HTTP processing: the big picture

4.3.3 Jukebox verticle basics

4.3.4 Incoming HTTP connections

4.3.5 Downloading as efficiently as possible

4.3.6 Reading MP3 files, but not too fast

4.4 Parsing simple streams

4.5 Parsing complex streams

4.6 A quick note on the stream fetch mode

4.7 Summary

5 Beyond callbacks

5.1 Composing asynchronous operations: the edge service example

5.1.1 Scenario

5.1.2 Heat sensor verticles

5.1.3 Snapshot service verticle

5.2 Callbacks

5.2.1 Implementation

5.2.2 Running

5.2.3 The “callback hell” is not the problem

5.3 Futures and promises

5.3.1 Futures and promises in Vert.x

5.3.2 Future-based APIs in Vert.x 4

5.3.3 Interoperability with CompletionStage APIs

5.3.4 Collector service with Vert.x futures

5.4 Reactive extensions

5.4.1 RxJava in a nutshell

5.4.2 RxJava and Vert.x

5.4.3 Collector service in RxJava

5.5 Kotlin coroutines

5.5.1 What is a coroutine?

5.5.2 Vert.x and Kotlin coroutines

5.5.3 Edge service with coroutines

5.6 Which model should I use?

5.7 Summary

6 Beyond the event-bus

6.1 Revisiting heat sensors with a service API

6.2 Return of the RPCs

6.3 Defining a service interface

6.4 Service implementation

6.5 Enabling proxy code generation

6.6 Deploying event-bus services

6.7 Service proxies beyond callbacks

6.8 Testing and Vert.x

6.8.1 Using JUnit 5 with Vert.x

6.8.2 Testing DataVerticle

6.8.3 Running the tests

6.9 Summary

6.10 References

Part 2: Developing reactive services with Vert.x

7 Designing a reactive application

7.1 What makes an application reactive

7.2 The 10k steps challenge scenario

7.3 One application, many services

7.4 Service specifications

7.4.1 User profile service

7.4.2 Ingestion service

7.4.3 Activity service

7.4.4 Public API

7.4.5 User web application

7.4.6 Event stats service

7.4.7 Congrats service

7.4.8 Dashboard web application

7.5 Running the application

7.6 Summary

7.7 References

8 The web stack

8.1 Exposing a public API

8.1.1 Routing HTTP requests

8.1.2 Making HTTP requests

8.2 Access control with JWT tokens

8.2.1 Using JWT tokens

8.2.2 What is in a JWT token?

8.2.3 Handling JWT tokens with Vert.x

8.2.4 Issuing JWT tokens with Vert.x

8.3 Cross-origin resource sharing (CORS)

8.3.1 What is the problem?

8.3.2 Supporting CORS with Vert.x

8.4 A modern web frontend

8.4.1 Vue.js

8.4.2 Vue.js application structure and build integration

8.4.3 Backend integration illustrated

8.4.4 Static content serving with Vert.x

8.5 Writing integration tests

8.6 Summary

8.7 References

9 Messaging and event streaming with Vert.x

9.1 Event-driven services beyond HTTP with Vert.x

9.1.1 What Vert.x provides

9.1.2 The middleware and services that we’ll use

9.1.3 What is AMQP? (and a message broker)

9.1.4 What is Kafka?

9.2 Reliably ingesting messages over HTTP and AMQP

9.2.1 Ingesting from AMQP

9.2.2 Translating AMQP messages to Kafka records

9.2.3 Ingesting from HTTP

9.3 Sending congratulation emails

9.3.1 Listening for daily step update events

9.3.2 Sending emails

9.4 Integration tests

9.4.1 Ingestion testing

9.4.2 Congratulation email testing

9.5 Summary

9.6 References

10 Persistent state management with databases

10.1 Databases and Vert.x

10.1.1 What the Eclipse Vert.x stack provides

10.1.2 A note on data / object mapping, and why you may not always need it

10.2 User profile service with MongoDB

10.2.1 Data model

10.2.2 User profile API verticle and initialization

10.2.3 Validating user input

10.2.4 Adding users in MongoDB

10.2.5 Authenticating a user

10.2.6 Fetching a user data

10.2.7 Updating a user data

10.3 Activity service with PostgreSQL

10.3.1 Data model

10.3.2 Opening a connection pool

10.3.3 Life of a device update event

10.3.4 Inserting a new record

10.3.5 Generating a device daily activity update

10.3.6 Activity API queries

10.4 Integration tests

10.4.1 Testing the user profile service

10.4.2 Testing the activity service API

10.4.3 Testing the activity service event handling

10.5 Summary

10.6 References

11 End-to-end real-time reactive event processing

11.1 Advanced stream data processing with Kafka and RxJava

11.1.1 Enriching daily device updates to generate user updates

11.1.2 Computing the device update ingestion throughput using time window aggregates

11.2 Real-time reactive web applications

11.2.1 Forwarding Kafka records to the Vert.x event-bus

11.2.2 Bridging the event-bus and web applications

11.2.3 From Kafka to live web application updates

11.3 Streams and state

11.3.1 A stream of updates

11.3.2 Hydrating the ranking state

11.3.3 Periodically updating rankings from the updates stream

11.4 Summary

11.5 References

12 Towards responsiveness with load and chaos testing

12.1 Initial experiments: is the performance any good?

12.1.1 Some considerations before load testing

12.1.2 Simulating users with Locust

12.1.3 Load testing the API with Hey

12.2 Let’s do some chaos engineering

12.2.1 Test plan

12.2.2 Chaos testing with Pumba

12.2.3 We are not resilient (yet)

12.3 From "scalable" to "scalable and resilient"

12.3.1 Enforcing timeouts

12.3.2 Using a circuit breaker

12.3.3 Resiliency and fallback strategies

12.4 Summary

12.5 References

13 Final notes: container-native Vert.x

13.1 Heat sensors in a cloud

13.1.1 Heat sensor service

13.1.2 Sensor gateway

13.1.3 Heat API

13.1.4 Deploying to a local cluster

13.2 Making the services work in Kubernetes

13.2.1 Building container images

13.2.2 Clustering and Kubernetes

13.2.3 Kubernetes deployment and service resources

13.3 First-class Kubernetes citizens

13.3.1 Health checks

13.3.2 Metrics

13.4 The end of the beginning

13.5 Summary

13.6 References

What's inside

  • An introduction to asynchronous programming and reactive systems
  • Building reactive services
  • Responding to external service failures
  • Horizontal scaling
  • Deploying with Docker, Kubernetes, and OpenShift

About the reader

Intended for intermediate Java developers familiar with web development, networked services, and enterprise Java frameworks like Spring or Java EE. No prior experience in asynchronous or reactive programming is required.

About the author

Julien Ponge is a Principal Software Engineer at Red Hat, working on reactive things and the Eclipse Vert.x project. He is on-leave from INSA Lyon where he was an Associate Professor in computer science and engineering, and he remains a research member of the CITI Laboratory. Drawing on his strong background in distributed systems and long-standing open source experience, he’s a regular speaker at user groups and conferences about Vert.x. He’s also the principal author of A gentle guide to asynchronous programming with Eclipse Vert.x for Java developers, which is part of the Vert.x core documentation.

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $29.99 $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
Vert.x in Action (print book) added to cart
continue shopping
go to cart

eBook $31.99 $39.99 3 formats + liveBook
Vert.x in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks