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
Copiar
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)truefará com que a fila comece a processar os trabalhos assim que eles forem adicionados.
Criação de uma fila
Copiar
await queue.createQueue('queue', 'execute', {
maxInflight: 10,
msgPerSecond: 100,
active: true
});
Copiar
options = CreateQueueOptions()
options.maxInflight = 10
options.msgPerSecond = 100
options.active = true
await queue.createQueue('queue', options)