Skip to content
This repository was archived by the owner on Dec 7, 2018. It is now read-only.

Commit f6c71d0

Browse files
abuijzegitbook-bot
authored andcommitted
GitBook: [master] 34 pages and 4 assets modified
1 parent b07579e commit f6c71d0

23 files changed

+733
-851
lines changed
30.5 KB
Loading
25.5 KB
Loading
25.5 KB
Loading
26.6 KB
Loading

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Introduction
2-
============
1+
# About this guide
32

43
Axon is a lightweight framework that helps developers build scalable and extensible applications by addressing these concerns directly in the architecture. This reference guide explains what Axon is, how it can help you and how you can use it.
54

6-
If you want to know more about Axon and its background, continue reading in [Axon Framework Background](part1/introduction.md#axon-framework-background). If you're eager to get started building your own application using Axon, go quickly to [Getting Started](part1/introduction.md#getting-started). If you're interested in helping out building the Axon Framework, [Contributing](part1/introduction.md#contributing-to-axon-framework) will contain the information you require. All help is welcome. Finally, this chapter covers some legal concerns in [License](part1/introduction.md#license-information).
5+
If you want to know more about Axon and its background, continue reading in [Axon Framework Background](part-i-getting-started/introduction.md#axon-framework-background). If you're eager to get started building your own application using Axon, go quickly to [Getting Started](part-i-getting-started/introduction.md#getting-started). If you're interested in helping out building the Axon Framework, [Contributing](part-i-getting-started/introduction.md#contributing-to-axon-framework) will contain the information you require. All help is welcome. Finally, this chapter covers some legal concerns in [License](part-i-getting-started/introduction.md#license-information).
6+

SUMMARY.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
# Summary
1+
# Table of contents
22

33
* [About this guide](README.md)
44

5-
### Part I - Getting started
6-
* [Introduction](part1/introduction.md)
7-
* [Architecture overview](part1/architecture-overview.md)
8-
* [Messaging concepts](part1/messaging-concepts.md)
9-
* [Configuration API](part1/configuration-api.md)
10-
11-
### Part II - Domain Logic
12-
* [Command Model](part2/command-model.md)
13-
* [Event Handling](part2/event-handling.md)
14-
* [Query Handling](part2/query-handling.md)
15-
* [Sagas](part2/sagas.md)
16-
* [Testing](part2/testing.md)
17-
18-
### Part III - Infrastructure components
19-
* [Command Dispatching](part3/command-dispatching.md)
20-
* [Event Processing](part3/event-processing.md)
21-
* [Query Processing](part3/query-processing.md)
22-
* [Repository and Event Store](part3/repositories-and-event-stores.md)
23-
* [Spring Boot AutoConfiguration](part3/spring-boot-autoconfig.md)
24-
25-
### Part IV - Advanced tuning
26-
* [Advanced customizations](part4/advanced-customizations.md)
27-
* [Performance Tuning](part4/performance-tuning.md)
5+
## Part I - Getting started
6+
7+
* [Introduction](part-i-getting-started/introduction.md)
8+
* [Architecture overview](part-i-getting-started/architecture-overview.md)
9+
* [Messaging concepts](part-i-getting-started/messaging-concepts.md)
10+
* [Configuration API](part-i-getting-started/configuration-api.md)
11+
12+
## Part II - Domain Logic
13+
14+
* [Command Model](part-ii-domain-logic/command-model.md)
15+
* [Event Handling](part-ii-domain-logic/event-handling.md)
16+
* [Query Handling](part-ii-domain-logic/query-handling.md)
17+
* [Sagas](part-ii-domain-logic/sagas.md)
18+
* [Testing](part-ii-domain-logic/testing.md)
19+
20+
## Part III - Infrastructure components
21+
22+
* [Command Dispatching](part-iii-infrastructure-components/command-dispatching.md)
23+
* [Event Processing](part-iii-infrastructure-components/event-processing.md)
24+
* [Query Processing](part-iii-infrastructure-components/query-processing.md)
25+
* [Repository and Event Store](part-iii-infrastructure-components/repository-and-event-store.md)
26+
* [Spring Boot AutoConfiguration](part-iii-infrastructure-components/spring-boot-autoconfiguration.md)
27+
28+
## Part IV - Advanced tuning
29+
30+
* [Advanced customizations](part-iv-advanced-tuning/advanced-customizations.md)
31+
* [Performance Tuning](part-iv-advanced-tuning/performance-tuning.md)
2832

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
1-
Architectural Overview
2-
======================
1+
# Architecture overview
2+
3+
## Architectural Overview
34

45
CQRS on itself is a very simple pattern. It only prescribes that the component of an application that processes commands should be separated from the component that processes queries. Although this separation is very simple on itself, it provides a number of very powerful features when combined with other patterns. Axon provides the building blocks that make it easier to implement the different patterns that can be used in combination with CQRS.
56

6-
The diagram below shows an example of an extended layout of a CQRS-based event driven architecture. The UI component, displayed on the left, interacts with the rest of the application in two ways: it sends commands to the application (shown in the top section), and it queries the application for information (shown in the bottom section).
7+
The diagram below shows an example of an extended layout of a CQRS-based event driven architecture. The UI component, displayed on the left, interacts with the rest of the application in two ways: it sends commands to the application \(shown in the top section\), and it queries the application for information \(shown in the bottom section\).
78

8-
![Architecture overview of a CQRS application](detailed-architecture-overview.png)
9+
![Architecture overview of a CQRS application](../.gitbook/assets/detailed-architecture-overview.png)
910

1011
Commands are typically represented by simple and straightforward objects that contain all data necessary for a command handler to execute it. A command expresses its intent by its name. In Java terms, that means the class name is used to figure out what needs to be done, and the fields of the command provide the information required to do it.
1112

1213
The Command Bus receives commands and routes them to the Command Handlers. Each command handler responds to a specific type of command and executes logic based on the contents of the command. In some cases, however, you would also want to execute logic regardless of the actual type of command, such as validation, logging or authorization.
1314

14-
The command handler retrieves domain objects (Aggregates) from a repository and executes methods on them to change their state. These aggregates typically contain the actual business logic and are therefore responsible for guarding their own invariants. The state changes of aggregates result in the generation of Domain Events. Both the Domain Events and the Aggregates form the domain model.
15+
The command handler retrieves domain objects \(Aggregates\) from a repository and executes methods on them to change their state. These aggregates typically contain the actual business logic and are therefore responsible for guarding their own invariants. The state changes of aggregates result in the generation of Domain Events. Both the Domain Events and the Aggregates form the domain model.
1516

16-
Repositories are responsible for providing access to aggregates. Typically, these repositories are optimized for lookup of an aggregate by its unique identifier only. Some repositories will store the state of the aggregate itself (using Object Relational Mapping, for example), while others store the state changes that the aggregate has gone through in an Event Store. The repository is also responsible for persisting the changes made to aggregates in its backing storage.
17+
Repositories are responsible for providing access to aggregates. Typically, these repositories are optimized for lookup of an aggregate by its unique identifier only. Some repositories will store the state of the aggregate itself \(using Object Relational Mapping, for example\), while others store the state changes that the aggregate has gone through in an Event Store. The repository is also responsible for persisting the changes made to aggregates in its backing storage.
1718

18-
Axon provides support for both the direct way of persisting aggregates (using object-relational-mapping, for example) and for event sourcing.
19+
Axon provides support for both the direct way of persisting aggregates \(using object-relational-mapping, for example\) and for event sourcing.
1920

2021
The event bus dispatches events to all interested event listeners. This can either be done synchronously or asynchronously. Asynchronous event dispatching allows the command execution to return and hand over control to the user, while the events are being dispatched and processed in the background. Not having to wait for event processing to complete makes an application more responsive. Synchronous event processing, on the other hand, is simpler and is a sensible default. By default, synchronous processing will process event listeners in the same transaction that also processed the command.
2122

2223
Event listeners receive events and handle them. Some handlers will update data sources used for querying while others send messages to external systems. As you might notice, the command handlers are completely unaware of the components that are interested in the changes they make. This means that it is very non-intrusive to extend the application with new functionality. All you need to do is add another event listener. The events loosely couple all components in your application together.
2324

2425
In some cases, event processing requires new commands to be sent to the application. An example of this is when an order is received. This could mean the customer's account should be debited with the amount of the purchase, and shipping must be told to prepare a shipment of the purchased goods. In many applications, logic will become more complicated than this: what if the customer didn't pay in time? Will you send the shipment right away, or await payment first? The saga is the CQRS concept responsible for managing these complex business transactions.
2526

26-
Since Axon 3.1 the framework provides components to handle queries. The Query Bus receives queries and routes them to the Query Handlers. A query handler is registered at the query bus with both the type of query it handles as well as the type of response it providers. Both the query and the result type are typically simple, read-only DTO objects. The contents of these DTOs are typically driven by the needs of the User Interface. In most cases, they map directly to a specific view in the UI (also referred to as table-per-view).
27+
Since Axon 3.1 the framework provides components to handle queries. The Query Bus receives queries and routes them to the Query Handlers. A query handler is registered at the query bus with both the type of query it handles as well as the type of response it providers. Both the query and the result type are typically simple, read-only DTO objects. The contents of these DTOs are typically driven by the needs of the User Interface. In most cases, they map directly to a specific view in the UI \(also referred to as table-per-view\).
2728

2829
It is possible to register multiple query handlers for the same type of query and type of response. When dispatching queries, the client can indicate whether he wants a result from one or from all available query handlers.
2930

30-
Axon Module Structure
31-
=====================
31+
## Axon Module Structure
3232

3333
Axon Framework consists of a number of modules that target specific problem areas of CQRS. Depending on the exact needs of your project, you will need to include one or more of these modules.
3434

35-
As of Axon 2.1, all modules are OSGi compatible bundles. This means they contain the required headers in the manifest file and declare the packages they import and export. At the moment, only the Slf4J bundle (1.7.0 <= version < 2.0.0) is required. All other imports are marked as optional, although you're very likely to need others.
35+
As of Axon 2.1, all modules are OSGi compatible bundles. This means they contain the required headers in the manifest file and declare the packages they import and export. At the moment, only the Slf4J bundle \(1.7.0 <= version < 2.0.0\) is required. All other imports are marked as optional, although you're very likely to need others.
3636

37-
Main modules
38-
------------
37+
### Main modules
3938

4039
Axon's main modules are the modules that have been thoroughly tested and are robust enough to use in demanding production environments. The maven groupId of all these modules is `org.axonframework`.
4140

@@ -51,20 +50,19 @@ The Spring module allows Axon components to be configured in the Spring Applicat
5150

5251
MongoDB is a document based NoSQL database. The Mongo module provides Event and Saga Store implementations that store event streams and sagas in a MongoDB database.
5352

54-
Several AxonFramework components provide monitoring information. The Metrics module provides basic implementations based on Codehale to collect the monitoring information.
53+
Several AxonFramework components provide monitoring information. The Metrics module provides basic implementations based on Codehale to collect the monitoring information.
5554

56-
Working with Axon APIs
57-
======================
55+
## Working with Axon APIs
5856

5957
CQRS is an architectural pattern, making it impossible to provide a single solution that fits all projects. Axon Framework does not try to provide that one solution, obviously. Instead, Axon provides implementations that follow best practices and the means to tweak each of those implementations to your specific requirements.
6058

61-
Almost all infrastructure building blocks will provide hook points (such as Interceptors, Resolvers, etc.) that allow you to add application-specific behavior to those building blocks. In many cases, Axon will provide implementations for those hook points that fit most use cases. If required, you can simply implement your own.
59+
Almost all infrastructure building blocks will provide hook points \(such as Interceptors, Resolvers, etc.\) that allow you to add application-specific behavior to those building blocks. In many cases, Axon will provide implementations for those hook points that fit most use cases. If required, you can simply implement your own.
6260

6361
Non-infrastructural objects, such as Messages, are generally immutable. This ensures that these objects are safe to use in a multi-threaded environment, without side-effects.
6462

6563
To ensure maximum customization, all Axon components are defined using interfaces. Abstract and concrete implementations are provided to help you on your way, but will nowhere be required by the framework. It is always possible to build a completely custom implementation of any building block using that interface.
6664

67-
Spring Support
68-
==============
65+
## Spring Support
6966

7067
Axon Framework provides extensive support for Spring, but does not require you to use Spring in order to use Axon. All components can be configured programmatically and do not require Spring on the classpath. However, if you do use Spring, much of the configuration is made easier with the use of Spring's annotation support.
68+
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
Configuration API
2-
=================
1+
# Configuration API
32

4-
Axon keeps a strict separation when it comes to business logic and infrastructure configuration. In order to do so, Axon will provide a number of building blocks that take care of the infrastructural concerns, such as transaction management around a message handler. The actual payload of the messages and the contents of the handler are implemented in (as much as possible) Axon-independent Java classes.
3+
Axon keeps a strict separation when it comes to business logic and infrastructure configuration. In order to do so, Axon will provide a number of building blocks that take care of the infrastructural concerns, such as transaction management around a message handler. The actual payload of the messages and the contents of the handler are implemented in \(as much as possible\) Axon-independent Java classes.
54

65
To make the configuration of these infrastructure components easier and to define their relationship with each of the functional components, Axon provides a Configuration API.
76

8-
Setting up a configuration
9-
--------------------------
7+
## Setting up a configuration
108

119
Getting a default configuration is very easy:
1210

13-
``` java
11+
```java
1412
Configuration config = DefaultConfigurer.defaultConfiguration()
1513
.buildConfiguration();
1614
```
@@ -21,15 +19,15 @@ Obviously, this configuration would not be very useful. You would have to regist
2119

2220
To do so, use the `Configurer` instance returned by the `.defaultConfiguration()` method.
2321

24-
``` java
22+
```java
2523
Configurer configurer = DefaultConfigurer.defaultConfiguration();
2624
```
2725

2826
The configurer provides a multitude of methods that allow you to register these components. How to configure those is described in detail in each component's respective chapter.
2927

3028
The general form in which components are registered, is the following:
3129

32-
``` java
30+
```java
3331
Configurer configurer = DefaultConfigurer.defaultConfiguration();
3432
configurer.registerCommandHandler(c -> doCreateComponent());
3533
```
@@ -38,20 +36,21 @@ Note the lambda expression in the `registerCommandBus` invocation. The `c` param
3836

3937
For example, to register a Command Handler that requires a serializer:
4038

41-
``` java
39+
```java
4240
configurer.registerCommandHandler(c -> new MyCommandHandler(c.serializer());
4341
```
4442

4543
Not all components have their explicit accessor method. To retrieve a component from the configuration, use:
46-
``` java
44+
45+
```java
4746
configurer.registerCommandHandler(c -> new MyCommandHandler(c.getComponent(MyOtherComponent.class));
4847
```
4948

5049
This component must be registered with the Configurer, using `configurer.registerComponent(componentType, builderFunction)`. The builder function will receive the `Configuration` object as input parameter.
5150

52-
Setting up a configuration using Spring
53-
---------------------------------------
51+
## Setting up a configuration using Spring
5452

5553
When using Spring, there is no need to explicitly use the `Configurer`. Instead, you can simply put the `@EnableAxon` on one of your Spring `@Configuration` classes.
5654

5755
Axon will use the Spring Application Context to locate specific implementations of building blocks and provide default for those that are not there. So, instead of registering the building blocks with the `Configurer`, in Spring you just have to make them available in the Application Context as `@Bean`s.
56+

0 commit comments

Comments
 (0)