How to initialize event store for local development?

Hi everybody,

We’re using Axon in a project with rapidly changing domain model in a distributed team of developers. Therefore it’s often necessary to agree on a basic number of “setup” events with a basic state created by specific events.

Another team at our company uses a startup database import - with Spring’s “data.sql” support, I believe. Is there a good (best?) practice how to distribute such a selection of basic events that all developers should have in their local environment?

Best regards,
Tim Benke

My team has implemented a fixture loading mechanism. The loader is implemented as a bean that only runs in development and staging environments. The fixture data is stored in JSON files, which are submitted using commands like anything else in Axon. I felt that maintaining SQL records could become burdensome, because as you mentioned the domain model is evolving rapidly, and there would be nothing to ensure they are correct.

Hi Joel,

thanks for the reply. Yes, that seems like a reasonable approach. In the application itself we’ll have the most control and flexibility to properly prepare the starting events. Using separate JSON files also seems to be the cleanest to specify the events.

Best regards,
Tim

Hi Tim,

We tried to do it several ways. What works best for us is an initialization of the event store, since it’s the single source of truth that all applications react to. We simply created a Spring project that can be run and that uses the publish method of the eventStore bean.

Actually we used to send Commands in out “initialization” part but that didn’t really work out because developers would have to run all the applications for Command Handlers to handle these commands and apply the resulting events. By initializing the events directly we’re making sure that developers only have to run the applications they’re working on.

Hope that helps !

Best regards,
Raphaël Jungers