EventStore API
IChronicleClient
Section titled “IChronicleClient”Entry point for the library.
interface IChronicleClient { fun getEventStore(name: String): IEventStore fun getEventStore(name: String, namespace: String): IEventStore fun close()}Factory functions:
ChronicleClient.development() // localhost:35000ChronicleClient(options: ChronicleOptions) // custom host/portIEventStore
Section titled “IEventStore”interface IEventStore { val eventLog: IEventLog val reactors: IReactorsService val reducers: IReducersService val projections: IProjectionsService val constraints: IConstraintsService val seeding: IEventSeedingService val readModels: IReadModelsService val compliance: IComplianceService val unitOfWork: UnitOfWorkManager}IEventLog
Section titled “IEventLog”interface IEventLog { suspend fun append(eventSourceId: String, event: Any): AppendResult suspend fun append( eventSourceId: String, event: Any, options: AppendOptions ): AppendResult suspend fun appendMany( eventSourceId: String, events: List<Any> ): List<AppendResult>}AppendResult
Section titled “AppendResult”| Property | Type | Description |
|---|---|---|
isSuccess | Boolean | true when no constraint violations |
sequenceNumber | EventSequenceNumber | Position in the event log |
constraintViolations | List<ConstraintViolation> | On failure |
IReactorsService
Section titled “IReactorsService”interface IReactorsService { suspend fun register(reactor: Any): Job}IReducersService
Section titled “IReducersService”interface IReducersService { suspend fun register(reducer: Any): Job}IReadModelsService
Section titled “IReadModelsService”interface IReadModelsService { suspend fun register(vararg readModelClasses: KClass<*>) suspend fun <T : Any> getInstanceByKey( readModelClass: KClass<T>, key: String ): T?}IProjectionsService
Section titled “IProjectionsService”interface IProjectionsService { suspend fun register(vararg projections: Any)}IConstraintsService
Section titled “IConstraintsService”interface IConstraintsService { suspend fun register(vararg constraints: Any)}IEventSeedingService
Section titled “IEventSeedingService”interface IEventSeedingService { suspend fun seed(vararg seeders: Any)}IComplianceService
Section titled “IComplianceService”interface IComplianceService { suspend fun release(subject: String, schema: String, payload: String): String}