-
Notifications
You must be signed in to change notification settings - Fork 2
es cqrs.ReplayService
Sclable CI edited this page Sep 11, 2024
·
198 revisions
es-cqrs.ReplayService
This service is used to replay events from the event store
Can be run in a separate script.
Example: replay.ts
@EventHandler(ReplayFinished)
class ReplayFinishedHandler implements IEventHandler<ReplayFinished> {
public handle() {
console.log('Replay finished')
}
}
@Module({
imports: [
ESCQRSModule.forRoot({...}),
FeatureModule1,
FeatureModule2,
],
})
class ResetAndReplayModule {}
async function run() {
const app = await NestFactory.create(ResetAndReplayModule)
await app.init()
const replayService = app.get<ReplayService>(ReplayService)
await replayService.replay()
await app.close()
}
run()
• new ReplayService(eventStore
, eventBus
, logger
, options
): ReplayService
Name | Type |
---|---|
eventStore |
EventStoreProvider |
eventBus |
EventBus |
logger |
Logger |
options |
EventStoreOptions |
packages/es-cqrs/src/event-store/replay.service.ts:57
• Private
Readonly
eventBus: EventBus
packages/es-cqrs/src/event-store/replay.service.ts:59
• Private
Readonly
eventStore: EventStoreProvider
packages/es-cqrs/src/event-store/replay.service.ts:58
• Private
Readonly
logger: Logger
packages/es-cqrs/src/event-store/replay.service.ts:60
• Private
Readonly
options: EventStoreOptions
packages/es-cqrs/src/event-store/replay.service.ts:61
▸ replay(replayOptions?
): Promise
<number
>
Name | Type | Description |
---|---|---|
replayOptions? |
ReplayOptions |
replay options |
Promise
<number
>
Retuns
number of events replayed