2.2.1 • Published 16 days ago

@nftx/queue v2.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
16 days ago

@nftx/ queue

This package is written specifically to allow communication and job running between NFTX-API and NFTX-API-INDEXER

Signals and Messages can be sent and received using this library. Signals are used to trigger an intended action whereas Messages are used to notify of events. They act very differently behind the scenes:

A signal is passed to bullmq which then passes it on to a single worker to process. You can have multiple listeners for a signal, but only 1 listener will be given the signal.

Messages, on the other hand, are broadcast to all listeners.

Usage

// Create a listener for the signal
onSignal(async (type, data) => {
  // Dispatch to the network-specific listener
  sendNetworkSignal(data.network, type, data);
});

// Create a listener for mainnet signals
onNetworkSignal(1, (type, data) => {
  switch (type) {
    case 'index-vault':
      // Handle indexing a vault here
      // Broadcast a message when the job is complete
      sendMessage('vault-indexed', {});
      break;
  }
});

// Create multiple listeners for messages
onMessage((type, data) => {
  switch (type) {
    case 'vault-indexed':
      // Do something
      breka;
  }
});

// Emit a signal
sendSignal('index-vault', { vaultId: '0' });
2.2.1

16 days ago

2.1.0

19 days ago

2.0.2

2 months ago

2.0.1

2 months ago

2.0.0

2 months ago

1.15.6

2 months ago

1.15.5

2 months ago

1.15.4

2 months ago

1.14.1

3 months ago

1.14.0

3 months ago

1.13.1

3 months ago

1.13.0

3 months ago

1.12.0

3 months ago

1.11.2

3 months ago

1.11.1

4 months ago

1.11.0

4 months ago

1.10.4

4 months ago

1.10.2

4 months ago

1.10.0

4 months ago

1.9.1

4 months ago

1.9.0

5 months ago

1.8.2

5 months ago

1.8.0

5 months ago

1.7.0

5 months ago

1.6.0

5 months ago

1.5.0

5 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.1.0

6 months ago