Thanks for your prompt reply Allard.
I did not explain myself properly. Here I am not referring to the database migration scripts, but to the priming and/or migration of commands and/or events. AXON uses the database, but it does not depend on one. I understand you are developing a file based persistence layer which keeps up the performance over time despite the vast number of events. Furthermore, others may decide to develop their custom persistence layer and this needs to be compatible with that.
Say that I have a system which requires an admin account and some basic information, for example. I would like to have means to send a group of command and/or events while the system starts (similar to how Flyway and Liquibase works). I do not want to trigger these commands/events every time the system starts, but only if these have not yet been triggered before. These can also be corrective events that needs to be triggered once following a bug fix deployment.
Following is a suggestion
@SomeAnnotation(“V1.1.7”)
public class SomeClassName {
/* Injection like Saga? */
@Autowired
private CommandGateway commandGateway;
@PossiblySomeotherAnnotation
public void run() {
commandGateway.send(new CreateUserCommand(/parameters/));
}
}
AXON will then guarantee that these commands are only executed once. Resources can be autowired in a similar fashon to sagas. These are short live objects and they can be discarded once executed.
This is just a thought and you are more than welcome to bake this as best fits framework, always if you like the idea. Again, I am more that happy to contribute to this or anything else.
With reference to one of your sentences:
However, having some Flyway and/or Liquibase definitions to create the tables (assuming defaults) would be nice to have. Having them would be better than SQL scripts, as they are database-specific.
I have a Flyway script which can be used (attached), but I do not think that this should be included in AXON because the persistence layer is quite dependent on the project. I used string UUID which are CHAR(36), but these can be saved as BINARY(16) (if I recall correctly), which are even smaller and faster. Some others may use numeric ids instead, in which case these need to be UNSIGNED BIGINT.
Would like to take this opportunity to wish you and your loved ones all the best.
Albert
V1__init_axon.sql (3.59 KB)