Queries

The third type of Message that an Axon application is associated with is the Query Message, or simply Queries. These are messages that request information in a certain format. Any application can declare it’s able to handle a query message, and provide a response to it.

Types of queries

There are multiple types of queries that cane be distinguished.

  1. Point-to-point queries: They are routed to a single handler, which is expected to return a single result. This is the most common type of query.

  2. Scatter-gather queries: These queries are dispatched to all handlers that are capable of handling the query. The results of all handlers are then aggregated and returned to the client.

  3. Subscription queries: These request an initial result and then continue to receive updates as long as the subscription is active.

  4. Streaming queries: These queries are used to request a stream of results, which are returned as they become available.

You can find more about each type of query in the Query Dispatchers section.

Subsections

A summary of the various sections is given below.

Subsection Purpose

Query Dispatchers / Query Handlers

Functional Development concerns for Query Messages using the Axon Framework

Implementations

Non-Functional Development concerns for Query Messages using the Axon Framework

Configuration

Configuration concerns for Query Messages using the Axon Framework

This guide is complemented by a video tutorial which gives a practical demonstration of the concepts explained in this section. The tutorial is available at -> Axon Coding Tutorial - Query Messages