Hello Axon nerds
My scenario looks simplified as follows:
I need to import a large number of objects, let’s say customer and order records. The import is a long running process consisting of multiple phases, e.g. first the customers are imported and afterwards the orders. After the import of the orders is finished I need to run some analysis on the imported orders.
My approach so far is that I trigger the import by a StartImport command and do the coordination of the long running import using a saga.
The whole import process works fine on the command side, everything runs smoothly in the background and the saga coordinates the different import phases by using different commands and events. On the command side, my import has a defined state and I can also signal the end of the overall process.
The problem is the last step, the analysis of the orders: This step needs to query the imported orders and must access the read model.
But how do I know when the eventual consistent projections of all imported orders are finished? I tried publishing an event after the last import order command to signal the end of import, but this event seem to be handled out of order and may “overtake” the projection events, at least it was not reliable. I am using TrackingEventProcessors and have a distributed setup.
It’s no problem that the projection of the orders take some time to get consistent, but I would like to have a reliable event that my saga can use, to trigger the analysis phase.
Somewhere else I am using a subscription query to get notified when the projection of a single object has been finished, but this approach simply does not feel right for this import process that deals with thousands of imported objects.
Any hints or ideas how to solve this kind of problem with Axon?
Klaus