Skip to main content
Version: Next

Framework

Hierarchy

Index

Constructors

constructor

Properties

app

readonlyapplicationContext

applicationContext: IMidwayGlobalContainer

configService

configService: MidwayConfigService

configurationOptions

configurationOptions: any

environmentService

environmentService: MidwayEnvironmentService

informationService

informationService: MidwayInformationService

loggerService

loggerService: MidwayLoggerService

middlewareService

middlewareService: MidwayMiddlewareService<Context, unknown, unknown>

mockService

mockService: MidwayMockService

Methods

publicaddJobToQueue

  • addJobToQueue(queueName: string, jobData: any, options?: JobsOptions): Promise<Job<any, any, string>>
  • Add a job to the queue

publicaddProcessor

  • addProcessor(processor: new (...args: any[]) => IProcessor, queueName: string, workerOptions?: WorkerOptions): Promise<Worker<any, any, string>>
  • Add a processor class and init a worker

applicationInitialize

  • applicationInitialize(options: IMidwayBootstrapOptions): Promise<void>

applyMiddleware

  • applyMiddleware<R, N>(lastMiddleware?: CommonMiddlewareUnion<Context, R, N>): Promise<MiddlewareRespond<Context, R, N>>
  • Type parameters

    • R
    • N

configure

  • configure(): any

publiccreateFlowProducer

  • createFlowProducer(options?: Partial<QueueBaseOptions>, producerName?: string): FlowProducer
  • Create a flow producer, if producerName is provided, it will be store.

createLogger

  • createLogger(name: string, option?: MidwayLoggerOptions): any

publiccreateQueue

  • createQueue(name: string, queueOptions?: Partial<QueueOptions>): BullMQQueue
  • Create a queue with name and queueOptions

publiccreateWorker

  • createWorker(queueName: string, processor: (job: Job<any, any, string>, token?: string) => Promise<any>, workerOptions?: Partial<WorkerOptions>): Worker<any, any, string>
  • Create a worker

getAppDir

  • getAppDir(): string

getApplication

getApplicationContext

  • getApplicationContext(): IMidwayGlobalContainer

getBaseDir

  • getBaseDir(): string

getConfiguration

  • getConfiguration(key?: string): any

getCoreLogger

  • getCoreLogger(): ILogger

getCurrentEnvironment

  • getCurrentEnvironment(): string

publicgetFlowProducer

  • getFlowProducer(producerName: string): FlowProducer
  • Get a flow producer by name

getFrameworkName

  • getFrameworkName(): string

getLogger

  • getLogger(name?: string): any

getMiddleware

  • getMiddleware(): ContextMiddlewareManager<Context, unknown, unknown>

getNamespace

  • getNamespace(): string

getProjectName

  • getProjectName(): string

publicgetQueue

  • Get a queue by name

publicgetQueueList

publicgetWorker

  • getWorker(queueName: string): Worker<any, any, string>
  • Get the first worker by queueName

publicgetWorkers

  • getWorkers(queueName: string): Worker<any, any, string>[]
  • Get all workers by queueName

initialize

  • initialize(options?: IMidwayBootstrapOptions): Promise<void>

isEnable

  • isEnable(): boolean

publicloadConfig

  • loadConfig(): void

run

  • run(): Promise<void>

runGuard

  • runGuard(ctx: Context, supplierClz: new (...args: any[]) => any, methodName: string): Promise<boolean>

publicrunJob

  • runJob(queueName: string, jobData: any, options?: JobsOptions): Promise<Job<any, any, string>>
  • @deprecated

    use addJobToQueue instead

setFrameworkLoggerName

  • setFrameworkLoggerName(loggerName: string): void
  • Set the default framework logger name

    @since

    4.0.0

setNamespace

  • setNamespace(namespace: string): void

stop

  • stop(): Promise<void>

useFilter

  • useFilter(filter: CommonFilterUnion<Context, unknown, unknown>): void

useGuard

  • useGuard(guards: CommonGuardUnion<Context>): void

useMiddleware

  • useMiddleware(middleware: CommonMiddlewareUnion<Context, unknown, unknown>): void