Token stays empty in tokenentry table

Hi,

We’ve recently found the need for tracking processors and started to implement some. All well, but on the test environment we encountered an issue.

The token and tokentype remain null.

I’ve tracked down the issue to the readEventData query from JdbcEventStorageEngine, combined with the fact that our globalIndex does not start at 0 (i.e. we have min(globalindex) > 100).

Now the fix for JdbcEventStorageEngine appears to be straight forward (and I think an issue and PR on github are in order if you agree), but it begs the question:

Should I ensure the globalindex to start at 0 and be without missing values?

(I mean, is my event stream broken if this is not the case?)

If there is no such requirement, I think JdbcEventStorageEngine should be changed.

Cheers,

Tim van Heugten

Hi Tim,

ideally, the global sequence starts at 0 (or 1) and increments without leaving ‘gaps’. But since ideal and practical are two separate things, Axon should be able to cope with gaps.
Axon 3.0.6 includes a mechanism to ignore “gaps” when they’re older than a certain amount of time (default 1 minute), because those gaps are not expected to contain uncommitted data but were rather rolled back or skipped altogether.

I had a look at the readEvents method, and agree with you that it will conclude “no events available” if the scope of an entire batch is empty. This could happen if the number of gaps exceeds the batch size. This is definitely unwanted behavior. Note that the alternative of using “setMaxRows” is also not really an option, since it doesn’t limit the query on the database side. It will only take a certain number of rows from the result into account. Queries will need to explicitly set the LIMIT in the SQL statement, which is different for each database vendor.
An elegant solution would be to allow the “schema” implementation to set the limit. According to W3Schools (not an authoritive source, but better than nothing), there are roughly 3 flavors: https://www.w3schools.com/sql/sql_top.asp, two of them as suffix, and one as prefix to the column names.

Or did you have another solution in mind? In either case, a PR would be highly appreciated!

Cheers,

Allard

Hi,

I hadn’t considered the fact that LIMIT is not sql-flavor agnostic, that complicates things a considerably.

I’ve created https://github.com/AxonFramework/AxonFramework/issues/419 to further discuss this issue.

Cheers,

Tim