Axon demo application - MongoDB as an event store
Based on seed project idugalic:axon-java-spring-maven-seed
This Axon demo project demonstrates use of MongoDB as an event storage. Spring configuration is located in the main application class.
This project is driven using maven.
Axon Server is used for message routing (MongoDB is used as event store/bus). You can download a ZIP file with AxonServer as a standalone JAR. This will also give you the AxonServer CLI and information on how to run and configure the server.
Alternatively, you can run the following command to start AxonServer in a Docker container:
$ docker run -d --name axonserver -p 8024:8024 -p 8124:8124 axoniq/axonserver
NOTE: To remove Axon Server completely and fallback to
simple
message buses excludeaxon-server-connector
fromaxon-spring-boot-starter
maven dependency in pom file.
You can run the following command to start your project locally:
$ ./mvnw spring-boot:run
This project comes with some rudimentary tests as a good starting point for writing your own. Use the following command to execute the tests using Maven:
$ ./mvnw test
For this demo to work, you must stand up a local MongoDB server.
On a Mac OS X machine with homebrew, just do this:
$ brew install mongodb
$ brew services start mongo
More installation options are found at http://docs.mongodb.org/manual/installation/.
$ curl -i -X POST -H 'Content-Type:application/json' -d '{"value" : "1002"}' 'http://localhost:8080/cards'
$ curl http://localhost:8080/cards