Skip to content

es cqrs.EventStoreAsyncOptions

Sclable CI edited this page Sep 11, 2024 · 198 revisions

Interface: EventStoreAsyncOptions

es-cqrs.EventStoreAsyncOptions

Asyncronous options for the event store

Example (useFactory): app.module.ts

@Module({
  imports: [
    ESCQRSModule.forRootAsync({
      inject: [GlobalOptionsProvider]
      useFactory: async (globalOptions: GlobalOptionsProvider) => {
        return await globalOptions.getEventStoreOptions()
      }
    }),
    MyModule,
  ]
})

Example (useClass / useExisting): app.module.ts

class OptionsFactory implements EventStoreOptionsFactory {
  public async createEventStoreOptions() {
    return { logging: true }
  }
}

@Module({
  imports: [
    ESCQRSModule.forRootAsync({
      useClass: OptionsFactory
    }),
    MyModule,
  ]
})

It is also possible to add additional imports for the options factory if the service required is in another module

Example (imports): app.module.ts

@Module({
  imports: [
    ESCQRSModule.forRootAsync({
      imports: [GlobalOptionsModule]
      inject: [GlobalOptionsProvider]
      useFactory: async (globalOptions: GlobalOptionsProvider) => {
        return await globalOptions.getEventStoreOptions()
      }
    }),
    MyModule,
  ]
})

Hierarchy

  • Pick<ModuleMetadata, "imports">

    EventStoreAsyncOptions

Table of contents

Properties

Properties

inject

Optional inject: any[]

Defined in

packages/es-cqrs/src/event-store/event-store-options.ts:95


useClass

Optional useClass: Type<EventStoreOptionsFactory>

Defined in

packages/es-cqrs/src/event-store/event-store-options.ts:96


useExisting

Optional useExisting: Type<EventStoreOptionsFactory>

Defined in

packages/es-cqrs/src/event-store/event-store-options.ts:97


useFactory

Optional useFactory: (...args: any[]) => EventStoreOptions | Promise<EventStoreOptions>

Type declaration

▸ (...args): EventStoreOptions | Promise<EventStoreOptions>

Parameters
Name Type
...args any[]
Returns

EventStoreOptions | Promise<EventStoreOptions>

Defined in

packages/es-cqrs/src/event-store/event-store-options.ts:99

Clone this wiki locally