Fake Mirrors
    Preparing search index...

    Class ConsumerRouter

    Represents the consumer router.

    The router acts as root of a consumer and handles the routing jobs to their respective processors.

    • get isActive(): boolean

      Checks if the router is active.

      Returns boolean

      true if the router is active, false otherwise.

    • Activates the router.

      Once activated, processors can be retrieved but not added.

      Returns this

      This router for method chaining.

    • Adds a processor for a specific queue and job.

      Processors can only be added before the router is activated.

      Type Parameters

      • T

      Parameters

      Returns this

      This router for method chaining.

      Error If the router is already active.

      Error If a processor for this job already exists.

    • Retrieves a processor for a specific queue and job.

      Processors can only be retrieved after the router is activated.

      Parameters

      • queueName: ConsumerQueueNames

        The name of the queue.

      • jobName: string

        The name of the job.

      Returns ConsumerProcessor<unknown>

      The processor function.

      Error If the router is not active.

      ConsumerError If the processor is not found.

    • Registers the router as a singleton in the DI container.

      Parameters

      • container: DIContainer

        The DI container to register in.

      Returns void