Principles of Vertx (2nd edition)
Minimum price
Suggested price

Principles of Vertx (2nd edition)

How to build reactive applications and be happy

About the Book

This is the second edition of the popular “Principles of Vertx” book. The work was completely rewritten in order to promote new programming paradigms, that we introduced by the fourth release (Vertx 4.x). Unlike other existing publications about the Vertx platform, this book took as its priority to introduce readers to established software architecture practices and their implementations using Vertx. The book uses a project driven approach and it covers Eclipse Vertx 4.x features.

Table of Contents

Chapter 1. Futures

The concept of Futures in Vertx 4

How to create Future instances

Using Java asynchronous types

With a hardcoded value

From Vertx Promises

The difference between a status and a value

Sequential composition patterns

How to handle a recovery

Concurrent composition patterns




Chapter summary

Chapter 2. Verticles

Why verticles are actors

Why verticles are not actors

A lifecycle of a verticle

The difference between standard and worker verticles

How to execute blocking code inside standard verticles

Chapter summary

Chapter 3. An application configuration and a dependency injection

A configuration management

Using custom configuration sources

The dependency injection pattern in Vertx applications

Chapter summary

Chapter 4. Testing

Test context instances and their lifecycles

Unit tests


Integration tests

API endpoints tests

Code coverage

Chapter summary

Chapter 5. Working with PostgreSQL databases in Vertx applications

Building blocks of the Vertx reactive client for PostgreSQL

Prepared queries

Row sets

Row mapping patterns

Notes about the usage of query builder libraries

CRUD operations with the Vertx reactive client for PostgreSQL

Save a new entity

Retrieve a single entity

Retrieve many entities

Delete an entity

Update an entity

How to handle schema creations and to manage migrations from Vertx applications

Execute queries in batches

The Pagination pattern

The Sorting pattern

How to handle aggregation operations

Aggregate data from two tables

Aggregate data from three tables

Chapter summary

Chapter 6. Working with MongoDB databases in Vertx applications

Make use of the MongoDB data model (documents instead of rows)

Document mapping patterns

CRUD operations with the Vertx reactive client for MongoDB

Save a new entity

Retrieve a single entity

Delete an entity

Retrieve many entities

Update an entity

Update using the save() method

Update using the updateCollection() method

How to manage bulk operations

Working with aggregation pipelines in Vertx applications

Chapter summary

Chapter 7. Making HTTP calls with the Vertx WebClient

How to execute requests without a body payload

How to execute requests with a body payload

Response predicates

Chapter summary

Chapter 8. Building REST APIs with Vertx

Make use of the Vertx web stack

The implementation of a CRUD REST service

An endpoint to create a new account

An endpoint to retrieve a single account

An endpoint to update an account

An endpoint to remove an account

An endpoint to retrieve a list of accounts

How to build a pagination for REST API in Vertx

Cross Origin Resource Sharing

Types of CORS requests

How to configure CORS with Vertx

A good error handling design

Chapter summary

Chapter 9. Dealing with file uploads in Vertx applications

An implementation of a file upload service component

Option A: store files in a local file system

Option B: store files on a FTP server

Option C: store files using a S3 compatible storage

An implementation of a file upload endpoint

Chapter summary

Chapter 10. Communication between application components in Vertx

An architecture of the io.vertx.core.eventbus.Eventbus

The Publisher component

The Bus component

The Message component

The Subscriber component

Implementations of standard communication paradigms in Vertx

The Broadcasting (Publish-subscribe) pattern

The Point to Point pattern

The Request-response pattern

Error handling mechanisms

The Dead Message pattern

The Invalid Message pattern

Chapter summary

Chapter 11. Authentication in Vertx applications

A concept of a token based authentication

Session tokens

Implementations of authentication features

Signup (Service)

Signup (Endpoint)

Login (Service)

Login (Endpoint)

Authenticate (Service)

Using the token based authentication with REST API


Chapter summary

Chapter 12. Architectural patterns for Vertx applications

Defining the application’s structure

How to use verticles?

Pattern 1. Using verticles as “applications”

Pattern 2. Using verticles as “proto” layers

Pattern 3. Using verticles as “proto” domains

Chapter summary

Chapter 13. Running single page apps on Vertx

On the frontend part (Vue + Vite)

Initialize a Vue 3 application

Set up a client side routing

Proxying API requests

On the backend part (Vertx)

Modify a build script

Serve the frontend from the WebVerticle component

Run the project

Chapter summary

Chapter 14. Deploying Vertx applications

Create fat jar applications

Use Docker with Vertx

Use Docker Compose with Vertx

Chapter summary

(Updated 12 July 2022)

  • Share this book

  • Categories

    • Cloud Computing
    • API Design
    • PostgreSQL
    • MongoDB
    • Java
    • Message-Driven Design
    • Actor Model
    • Distributed Systems
    • Event-Driven Architecture
    • Reactive
    • Automated Software Testing
    • Web Development
  • Feedback

    Email the Author(s)

About the Author

Yuri Mednikov
Yuri Mednikov

Yuri Mednikov (Iurii Mednikov) is a principal Java architect with more than 15 years of programming experience in Java and with more than 6 years dedicated to the Eclipse Vertx platform. As a truly passionate reactive programming advocate, Yuri Mednikov creates unique Eclipse Vertx courses and shares more Vertx content via his Youtube channel than anyone else.

Yuri Mednikov is a member of the International Associations of Engineers (IAENG) and the Association for Computing Machinery (ACM).

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub