Once you have written your services and event handlers you must configure the Spring application context to instantiate them and wire them together.
You must define Spring beans for your services and event handlers.
As always, you can either do this explicitly using @Bean
definitions or you can use component scanning.
If your code uses the high-level event handler API then you must annotate your @Configuration
class with @EnableJavaEventHandlers
:
@Configuration
@EnableJavaEventHandlers
class MyConfigurationClass {
...
}
You must @Import
into your Spring ApplicationContext
an @Configuration
class for an event store client implementation.
Your production code will use @Import(EventStoreHttpClientConfiguration.class)
, which imports the configuration for the Eventuate HTTP/STOMP client.
Your test code can also use the Eventuate client.
However, you can sometimes simplify tests by using the embedded test Event Store.
Configure your test code’s application context by using @Import(JdbcEventStoreConfiguration.class)
If you are using the Eventuate Client (rather than the test client), you must configure it to talk to the Eventuate server. The Eventuate Client uses the Spring Boot Externalized configuration mechanism.
You must specify the following properties:
eventuate.apiKeyId
- API key id (previously eventStore.userId)eventuate.apiKeySecret
- API key secret (previously eventStore.password)If you are using an older version of the client framework then you must specify the following properties:
eventStore.stompServerHost
- host name or IP address of STOMP
servereventStore.stompServerPort
- STOMP server porteventStore.url
- HTTP URLeventStore.userId
- user ideventStore.password
- password