nestjs-event-store
nestjs-event-store copied to clipboard
how to access service in IAdapterStore?
How is it possible to write/ read to/from database in the AdapterStore?
I have a service with methods for reading from and writing the my database to read the last checkpoints position, but I don't have access to that in the Module setup, static
method
static register(): DynamicModule {
return {
module: GamesModule,
imports: [
CqrsModule,
EventStoreModule.registerFeatureAsync({
type: 'event-store',
useFactory: async (...args) => {
return {
featureStreamName: '$ce-game',
type: 'event-store',
subscriptions: [
{
type: EventStoreSubscriptionType.CatchUp,
stream: '$ce-game',
},
],
eventHandlers: EventStoreInstanciators,
store: {
storeKey: 'game',
write: async (key: string, value: number) => {
// service method to write to database
}
is it maybe accessed without the NestJS module infrastructure?
the answer I guess is in here but can't find more information on it
import { MongoStore } from './mongo-eventstore-adapter';