Understanding the tracking process - Axon 3, Springboot

Hello guys,

I would like to ask some questions about the tracking process.

  1. After setting up a successful example, I noticed that the engine executes (show_sql = true) intensively Selects and Updates the domain and token tables. Is there any way to schedule the time for this check? I’m a little worried about performance since my application can autoscale automatically.

  2. Is there any way I can call this check programmatically? That way, I could provide some API to call at specific times.

  3. The monitoring process is only verifying the public scheme. How could I specify the schemas?

I’m using the basic configuratin with Axon 3 and springboot

@Autowired
public void configure(EventHandlingConfiguration config) {
config.registerTrackingProcessor(“MyProcessorName”);
}

Thank you

Note that eventHandlingConfiguration.registerTrackingProcessor(…) will return the eventHandlingConfiguration instance. You’re explicitly starting it and shutting it down. That’s not necessary. In fact, it may cause issues later on.

All you need to do is:

    @Autowired
    public TrackingProcessorConfig(EventHandlingConfiguration eventHandlingConfiguration) {
        eventHandlingConfiguration.registerTrackingProcessor("JpaCreateServiceTypeHandler");
    }

Cheers,

Allard

Hello,
I have the same questions of Mike…
I configured a tracking processor in this way:


    @Autowired
    public void configure(EventHandlingConfiguration config, EventStore eventStore) {
//        config.usingTrackingProcessors();
        config.registerTrackingProcessor(TRACKING_PROCESSO_LOTTO);

    }

but now, every 2 seconds, I see the following SQL activities on the log:

2017-04-13 00:15:49.308 DEBUG 49238 — [rocesso-lotto-0] org.hibernate.SQL : update token_entry set timestamp=? where processor_name=? and segment=?

2017-04-13 00:15:50.138 DEBUG 49238 — [dedEventStore-0] org.hibernate.SQL : select domaineven0_.global_index as col_0_0_, domaineven0_.type as col_1_0_, dom

Is this the correct behavior?
And, most important, is order to use the “replay” do I have to configure a tracking processor in advance?
I mean, what happens if I put the app in production without the tracking processor and later I need to replay the events that populate a specific table/projection?

Kind regards,

Giancarlo

And, most important, is order to use the "replay" do I have to configure a
tracking processor in advance?
I mean, what happens if I put the app in production without the tracking
processor and later I need to replay the events that populate a specific
table/projection?

Kind regards,

Giancarlo

Yeah, thats my main concern about Axon right now. I didnt receive any good
answer for that too and I couldnt find a snippet code
On axon 3.0.3 theres a way to pause/resume according to the release notes.
But I'm not sure about how to use it.

I was working on a custom Code with SpringBatch to read from
DomainEventEntry directly and call my Handler manually. Ugly.
Also I'm still having problems with multitenancy, another subject.

Check this post:

https://groups.google.com/forum/#!topic/axonframework/EZWrafuk_o4

Hi Giancarlo, Mike,

Giancarlo:

The SQL activity you are seeing is intended behavior.
The TrackingEventProcessor will try to retrieve a token often, to ensure it is up to date with the event store.

Giancarlo, Mike:

It is not required to specify an Event Processing Group as tracking up front.

You can change this later on if you want that.

It however means that when you start up the application with your ‘fresh’, now tracking event processing group, that the Token starts at ‘globalIndex’ 0.

It would thus start replaying immediately, since the TrackingEventProcessor thinks it has not handled any events from the event store yet.

Mike:

The be able to retrieve a Event Processing Group by it’s name to call the pause/resume functionality, Allard’s made a change in the EventHandlingConfiguration allowing you to retrieve a list of the processing groups.

This is scheduled for 3.0.4., which should be released today.

So, stay tuned :slight_smile:

Hoping to be of help!

Cheers,
Steven

Hi Steven,
thank you for your swift and useful reply.

I don’t like the idea of a tracking processor that continuously queries the database.

I’m thinking about the following strategy:

  1. stop the application

  2. start a tools with the tracking processor configured just to replay the events

  3. restart the application
    What do you think about it?

Is there any suggested strategy in order to replay some events?
Is it possible to apply some criteria to the tracking processor in order to filter out some events ?

Thanks in advance,

Giancarlo

Hi Mike,

Also I’m still having problems with multitenancy, another subject.

What kind of problems are you having with multi tenancy?
On another project, we are using Axon2.4 and now we are planning to add multi-tenancy to the application.

King regards,
Giancarlo

Hi Steven and Giancario,

Good morning and thanks for the answer, Steven. I saw Allard answer on another topic talking about that new functionality. Looks good.

Giancario, about the tenant:

The processor will run on a different thread. My application uses a ThreadLocal to set the “tenant” based on schema. Since the Processor starts another Thread, the processor keeps running on ‘public’ schema.
So I still didnt fix that problem.

A colleague of mine had a similar issue. He ended up implementing a wrapper around the processor which instantiate several other processor instances (one per tenant) using the specific datasource for each tenant. This will cause a thread per tenant to start processing events, but at least you process each tenant separately.
They didn’t need to add tenants on the fly. You could probably do that in your wrapper class.

I haven’t seen the wrapper they have produced, but essentially it keeps track of all the listeners assigned to the processor. When the processor starts, it creates a TrackingProcessor instance for each tenant they have, passing the event listeners in the constructor. It also starts each individual processor. The source of each processor is set to a source that wraps the original event store, and set the correct Thread Local on each method invocation before delegating it to the Event Store.

Hope this helps.
Cheers,

Allard