Stratal API Reference
    Preparing search index...

    Class SyncQueueProvider

    Sync Queue Provider

    Processes messages immediately by finding matching consumers and calling their handle() method directly. Used for testing and development where real queue infrastructure is not available.

    Behavior:

    • Messages are processed synchronously when send() is called
    • Matching consumers are found via ConsumerRegistry by message type
    • All matching consumers are called sequentially
    • Errors are re-thrown after onError() is called (fail-fast for testing)

    Consumer Matching:

    • Consumers are matched by message type, not queue name
    • Wildcard ('*') matches all message types
    const provider = new SyncQueueProvider(registry)
    await provider.send('notifications-queue', {
    id: '123',
    timestamp: Date.now(),
    type: 'email.send',
    payload: { to: 'test@example.com' }
    })
    // Consumer's handle() is called immediately!

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Process a message synchronously

      Finds all matching consumers by message type and calls their handle() method. If any consumer throws, onError() is called and the error is re-thrown.

      Type Parameters

      • T

      Parameters

      • _queueName: string

        Queue name (not used for routing, consumers match by message type)

      • message: QueueMessage<T>

        Complete message with id, timestamp, and payload

      Returns Promise<void>

      Re-throws any error from consumer.handle() after calling onError()