I have a use case where every hour I have a job which is scheduled to run.
The job is not attached to any aggregate - the code that runs sits in two separate JVM processes that share an Axon Server instance:
- So we have JVM (a) and JVM (b).
The steps are essentially:
- JVM (a): Publish ‘instruction’ event instructing that the job needs to run (once every hour).
- JVM (b): Receive ‘instruction’ event, query an external API to retrieve a whole load of data (~5mb), publish event with data that is retrieved.
- JVM (a): Receive event with the data and perform transformations on that data (further filtering, publish more events (for JVM (a))), etc.
- The point here is to transform the outside data into a list of ‘create/update aggregate commands’.- JVM (a): Create/Update a number of aggregates (by issuing commands).
Now aside from what is highlighted red, I do not want any of the events which are published as part of this job to be stored in the event store:
-
For my use case having information about the job being placed in a log rotated file is fine.
-
In this regard, Axon event publishing is being used more to logically organise code rather than for event sourcing/event storage.
-
Of course, for the bit in red, given that aggregates are being created we would want those events to be stored like normal.
My question is what would be the best way to organise this code for my use case.
If I publish an event, currently it will always go into the event store.
I note that if I were using Query and QueryHandler then the logic could potentially be broken up as described and it would not be stored in the event store.
Please advise,
Regards,
vab2048