Skip to content

hyper63/hyper-adapter-bullmq

Repository files navigation

hyper-adapter-bullmq

A Queue port adapter for BullMQ in the hyper service framework

Test Current Version


Getting Started

import { default as bullmq } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-bullmq/v1.0.1/mod.ts'

export default {
  app,
  adapter: [
    {
      port: 'queue',
      plugins: [
        bullmq({
          url: 'http://user@password@redis.host:6379',
        }),
      ],
    },
  ],
}

You can pass the following configuration to the adapter:

export type AdapterConfig = {
  /**
   * The redis server connection string
   */
  url: string
  options?: {
    /**
     * How many Workers to spawn in order to process jobs.
     *
     * Defaults to 10
     */
    concurrency?: number
    /**
     * The Time-To-Live for jobs whose processing fails. The job payload,
     * along with the error is stored in redis.
     *
     * Defaults to 7 days.
     */
    failedTtl?: number
    /**
     * A prefix you'd like all keys created by the adapter to use.
     *
     * Defaults to no prefix ie. ''
     */
    keyPrefix?: string
    /**
     * Whether the Redis Server being used is clustered.
     *
     * Defaults to false
     */
    cluster?: boolean
  }
}

Methods

This adapter fully implements the Queue port and can be used as the hyper Queue service adapter

See the full port here

Testing

Run Tests

deno task test

To lint, check formatting, and run unit tests

Run Integration Tests

You will need a Redis Server running and REDIS_URL set to your Redis server connection string

deno task test:integration

Run Test Harness

deno task test:harness

License

Apache-2.0