-
Notifications
You must be signed in to change notification settings - Fork 88
/
SpringCourierConfiguration.kt
29 lines (21 loc) · 1.31 KB
/
SpringCourierConfiguration.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.drestaurant.courier.domain
import org.axonframework.eventhandling.EventBus
import org.axonframework.eventsourcing.EventCountSnapshotTriggerDefinition
import org.axonframework.eventsourcing.Snapshotter
import org.axonframework.spring.config.AxonConfiguration
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
internal class SpringCourierConfiguration {
@Bean
fun courierCommandHandler(axonConfiguration: AxonConfiguration, eventBus: EventBus) = CourierCommandHandler(axonConfiguration.repository(Courier::class.java), eventBus)
@Value("\${axon.snapshot.trigger.treshold.courier}")
private val snapshotTriggerTresholdCourier: Int = 100
@Value("\${axon.snapshot.trigger.treshold.courierorder}")
private val snapshotTriggerTresholdCourierOrder: Int = 100
@Bean("courierSnapshotTriggerDefinition")
fun courierSnapshotTriggerDefinition(snapshotter: Snapshotter) = EventCountSnapshotTriggerDefinition(snapshotter, snapshotTriggerTresholdCourier)
@Bean("courierOrderSnapshotTriggerDefinition")
fun courierOrderSnapshotTriggerDefinition(snapshotter: Snapshotter) = EventCountSnapshotTriggerDefinition(snapshotter, snapshotTriggerTresholdCourierOrder)
}