Processor Management
Event processors are the components in your application that process events. They can be used to update a read model, send an email, or do any other action based on the events in your system.
AxonIQ Console provides you with an overview of all your processors, their instances, and their segments. It also allows you to act on these processors, like starting, stopping, or pausing. You can also set up alerts for your processors, so you get notified when something goes wrong.
This page describes the features individually. For an in-depth explanation of the screens, see the Onboarding Guide. For more information about the statistics available on the processor detail page, see the Metrics feature page.
Streaming event processors
Streaming event processors are processors that process events asynchronously by streaming the event store. They claim segments of the event store and process the events that match that segment’s filter. This allows you to process events in parallel, which can greatly improve the performance of your application.
When a segment is being processed, it is claimed by a single instance of the processor. This means that no other instance can claim that segment. However, if a segment is not being processed, that means that a part of your event stream is not being processed. This can lead to outdated read models, or other problems in your application. Or, if your event processor is too slow, it can lead to an increased latency (time until data is available) in your application.
It’s thus crucial to ensure that all segments are being processed, and that the processors are not too slow. You will also want to be able to manage the processors by implementing controls that can pause and start them, increase or decrease the number of segments, and trigger a replay of the events. While you can build it yourself using the Axon Framework API This is where AxonIQ Console comes in.
Starting and pausing processors
You can pause processors to stop them from processing events. This can be useful if you want to stop processing events for a while, for example, to do maintenance on your application.
To pause all instances of a processor, click the "Pause" button in the left processor detail page. When you are done, you can click the "Start" button to start processing events on all instances again. The "Start" button is the first button and the "Pause" button is the second button in the image below.
These actions are done on the currently online nodes. If a node comes online with the event processor started, it will start processing events anyway. |
If you want to stop an individual instance of a processor, you can do so by clicking the "Pause" button of that row in the instances table. This will stop processing events on that instance, but not on the other instances. When you are done, you can click the "Start" button to start processing events on that instance again.
Splitting and merge segments
As mentioned in Streaming event processors, segments are parts of the event stream that are processed in parallel. By default, a Pooled Streaming Event Processor has 16 segments, and a Tracking Event Processor 1, depending on the configuration at the time the processor was created.
You can increase or decrease the number of segments to increase or decrease the parallelism of your application. However, this can not be done using configuration because segments are only initialized when the processor is started for the first time. After that, you need to use the Split and Merge actions of Axon Framework programmatically, or you can use AxonIQ Console.
It’s likely that your event processor interacts with the database, or you use a token store implementation that stores the tokens in the database. This means that more segments require a higher number of connections to the database. If you use a database, it’s important that your database pool can handle this increase in number of connections. Make sure your database and the connection pool of your application can handle this, or you might run into problems. |
You can use the "Split" and "Merge" buttons in the Processor detail page to split or merge segments. These buttons are shown in the image below. The "Merge" button is the third button in the left column, and the "Split" button is the fourth button in the image below.
The "Split" button will only be enabled if the event processor has "Free Segment Capacity", which can be found in the left column. This is the number of segments that can be claimed by an instance of the processor. If this number is 0, you can not split the segments, as then the segment would not be able to be processed.
We recommend using Pooled Streaming Event Processors for most applications. While every segment requires a thread when using Tracking Event Processors, Pooled Streaming Event Processors use one thread for reading events and handing packages to a pool of threads that process the events. Because of this design, Pooled Streaming Event Processors are more efficient in most cases. |
Trigger a replay
You can reset the position of the segments of a processor, causing what we call a replay. This can be useful if you want to consume the whole event stream, or part thereof, again, for example to fix a bug in your application.
In order to execute a reset well, you need to ensure that the processor is paused on all nodes before the reset. Likewise, you need to ensure that the processor is started on all nodes after the reset. AxonIQ Console makes sure this is done in the right order, and that all instances of the processor are stopped before the reset is executed.
To reset a processor, click the "Reset" button in the left column of the processors' detail page. This will open a dialog in which you can specify to which point you want to reset the processor. You can choose to reset to position 0 (tail), to the latest position (head), or to a specific time.
As the dialog already mentions, this will invoke any @ResetHandler
of the processor, which can be used to, for example, clear the read model before filling it again.
This action can not be undone. Make sure you want to reset the processor before you do it. While replaying events can be useful, it can take some time, during which your application has an outdated read model. |
During the replay, the segments table will show the progress of the replay, like in the image below.
Once the replay is done, the status will return to "Running".
Moving a segment
You can move a segment from one instance to another. This can be useful if you want to balance the load of your processors, or if you want to move a segment to another instance for maintenance.
To move a segment, click the "Move" button in the row of the segment you want to move. This will open a dialog in which you can select the instance you want to move the segment to.
After clicking "Move Segment", all processors except the one chosen will be asked to blacklist that segment for a short period of time. This is to ensure that the segment is not claimed by another instance while it is being moved. Then, the chosen instance will be asked to claim the specific segment.
Automatic balancing and scaling
While you can load-balance a processor’s segment manually, like outlined in Moving a segment, AxonIQ Console can also do this for you automatically. This feature is only available in the Premium and Enterprise plans of AxonIQ Console.
You can enable automatic load balancing by going to the "Automation" tab of the processor’s detail page. Here you can enable or disable the automatic load balancing.
When automatic load balancing is enabled, AxonIQ Console will automatically balance the segments of the processor over the instances of the processor. This is done by moving segments from instances that have a lot of segments to instances that have fewer segments.
Additionally, you can add automatic scaling, defining how many segments you want per instance. AxonIQ Console will then create or remove segments to ensure that the number of segments per instance is as close to the defined number as possible. AxonIQ Console will never exceed the "Free Segment Capacity" of the processor. If the processor has a "Free Segment Capacity" of 0, AxonIQ Console will not create any new segments for scaling.
You can choose whether AxonIQ Console will execute your chosen strategy this upon node connection changes, periodically, or both.