Once you have written your services and event handlers you must configure the Micronaut application context to instantiate them and wire them together.
You must define Micronaut beans for your services and event handlers.
You can either do this using @Singleton
inside a factory or on a bean class itself.
If you are using snapshot strategies they must be defined as Micronaut Beans. For example,
@Singleton
public AccountSnapshotStrategy accountSnapshotStrategy() {
return new AccountSnapshotStrategy();
}
You must have in your classpath a @Factory
class for an event store client implementation.
There are the following options:
EventuateLocalFactory
- used for Eventuate Local client:dependencies {
compile "io.eventuate.local.java:eventuate-local-java-micronaut-jdbc:${eventuateLocalVersion}"
}
EmbeddedTestAggregateStoreFactory
- used for embedded test Event Store.
This is useful for tests:dependencies {
testCompile "io.eventuate.client.java:eventuate-client-java-micronaut-jdbc:$eventuateClientVersion"
}
The Eventuate Client uses the Micronaut configuration mechanism.
You must specify the following properties:
datasources:
default:
url: ${DATASOURCE_URL}
driverClassName: ${DATASOURCE_DRIVERCLASSNAME}
username: ${DATASOURCE_USERNAME}
password: ${DATASOURCE_PASSWORD}
eventuatelocal:
kafka:
bootstrap:
servers: ${DOCKER_HOST_IP}:9092
zookeeper:
connection:
string: ${DOCKER_HOST_IP}:2181