Criar uma fila

Ao criar uma fila, você especifica o maxInflight e o msgPerSecond parâmetros. O uso conjunto desses parâmetros permitirá que você controle a taxa de retirada da fila.

Assinatura do método

createQueue(queueName: string, callback: string, options: ICreateQueueOptions)

Tipos

CreateQueueOptions:

  • maxInflight: (Número) O número de tarefas que você pode executar simultaneamente.
  • msgPerSecond: (Número) O número de tarefas a serem enviadas ao seu endpoint de callback por segundo.
  • active: (booleano) true fará com que a fila comece a processar os trabalhos assim que eles forem adicionados.

Criação de uma fila

await queue.createQueue('queue', 'execute', { 
    maxInflight: 10, 
    msgPerSecond: 100, 
    active: true
});
options = CreateQueueOptions()
options.maxInflight = 10
options.msgPerSecond = 100
options.active = true

await queue.createQueue('queue', options)