Hi there,
this question is slightly off topic as it is more about concepts, but I’m a (happy) Axon user, so I ask here for insights…
I’m facing the problem of data import from 3rd party applications using commands.
Imagine an organization aggregate consisting of an id, organization name, organization type, a address and so on. The import data comes as snapshots of data of varying granularity, e.g. a line in a CSV file giving the name and type of a to be imported organization. Another one might give just the id and a address. These formats are not fixed, so a flexible approach is needed.
Right now I have one create, edit, and delete command for each aggregate used in the import process. This works quite good if all data is at hand in the importer. However, as mentioned above the CSV file might just not transport the organization address in the current import data source. The e.g. edit command expects a complete snap shot of the organization containing all data, however. What to do in this situation without typing Java code like crazy?
-
I might write a command for a concrete input format, e.g. a edit command taking only the name and the type. However, this leads to many commands for different scenarios and a lot of lines in the command handler. Not nice.
-
I might add a boolean flag for each field in the command marking it as to be processed or not. Also not so nice, as this boils over to events and ultimately leads to a complex command handling and an even more complex service for building the read side.
-
I might load data from the read side to complete the command. This might have concurrency issues as I don’t know if e.g. the address is the right one or a new one is currently processed.
Have you dealt with such problems in the past? Did you find another viable solution which I have not thought of? Or have you got any tricks to make a solution listed above appear more viable?
Thanks!
-Sebastian