npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ez4/queue

v0.44.0

Published

EZ4: Components to build queue services

Downloads

328

Readme

EZ4: Queue

It uses the power of reflection to provide a contract that determines how to build and connect queue components.

Getting started

Install

npm install @ez4/queue @ez4/local-queue @ez4/aws-queue -D

Create queue

// file: queue.ts
import type { Environment, Service } from '@ez4/common';
import type { Queue } from '@ez4/queue';

// MyQueue message
type MyQueueMessage = {
  foo: string;
  bar: number;
};

// MyQueue declaration
export declare class MyQueue extends Queue.Unordered<MyQueueMessage> {
  retention: 600;

  subscriptions: [
    Queue.UseSubscription<{
      handler: typeof eventHandler;
    }>
  ];

  variables: {
    myVariable: Environment.Variable<'MY_VARIABLE'>;
  };

  services: {
    otherService: Environment.Service<OtherService>;
    variables: Environment.ServiceVariables;
  };
}

// MyQueue message handler
export function eventHandler(request: Queue.Incoming<MyQueueMessage>, context: Service.Context<MyQueue>): void {
  const { otherService, variables } = context;
  const { message } = request;

  // Access message contents
  message.foo;

  // Access injected services
  otherService.call();

  // Access injected variables
  variables.myVariable;
}

Use queue

// file: handler.ts
import type { Service } from '@ez4/common';
import type { MyQueue } from './queue';

// Any other handler that has injected MyQueue service
export async function anyHandler(_request: any, context: Service.Context<DummyService>) {
  const { myQueue } = context;

  await myQueue.sendMessage({
    foo: 'foo',
    bar: 123
  });
}

Queue properties

Service

| Name | Type | Description | | ------------- | ----------------------- | ------------------------------------------------------------------ | | fifoMode | Queue.UseFifoMode<> | Enable and configure the FIFO mode options. | | deadLetter | Queue.UseDeadLetter<> | Enable and configure the dead-letter queue options. | | subscriptions | Queue.UseSubscription<> | All subscriptions associated to the queue. | | delay | integer | Maximum delay (in seconds) to make messages available. | | polling | integer | Maximum wait time (in seconds) for receiving messages. | | retention | integer | Maximum retention time (in minutes) for all messages in the queue. | | timeout | integer | Maximum acknowledge time (in seconds) for the handler. | | variables | object | Environment variables associated to all subscription. | | services | object | Injected services associated to all subscription. |

Use type helpers for fifoMode, deadLetter and subscriptions properties.

Subscriptions

| Name | Type | Description | | ------------ | -------- | ----------------------------------------------------- | | listener | function | Life-cycle listener function for the subscription. | | handler | function | Entry-point handler function for the subscription. | | variables | object | Environment variables associated to the subscription. | | logRetention | integer | Log retention (in days) for the handler. | | memory | integer | Memory available (in megabytes) for the handler. | | concurrency | integer | Maximum number of concurrent executions handlers. | | batch | integer | Maximum number of messages per handler invocation. |

Examples

Providers

License

MIT License