Add pollInterval option to mqSubscriptions #1021

pull/1054/head
Zef Hemel 2024-08-18 12:36:23 +02:00
parent cf054fa186
commit 9e3fe5db73
2 changed files with 3 additions and 1 deletions

View File

@ -30,6 +30,7 @@ export type EventHookT = {
type MQSubscription = { type MQSubscription = {
queue: string; queue: string;
batchSize?: number; batchSize?: number;
pollInterval?: number;
autoAck?: boolean; autoAck?: boolean;
}; };
export type MQHookT = { export type MQHookT = {

View File

@ -52,12 +52,13 @@ export class MQHook implements Hook<MQHookT> {
const subscriptions = functionDef.mqSubscriptions; const subscriptions = functionDef.mqSubscriptions;
for (const subscriptionDef of subscriptions) { for (const subscriptionDef of subscriptions) {
const queue = subscriptionDef.queue; const queue = subscriptionDef.queue;
// console.log("Subscribing to queue", queue); // console.log("Subscribing to queue", queue, subscriptionDef);
this.subscriptions.push( this.subscriptions.push(
this.mq.subscribe( this.mq.subscribe(
queue, queue,
{ {
batchSize: subscriptionDef.batchSize, batchSize: subscriptionDef.batchSize,
pollInterval: subscriptionDef.pollInterval,
}, },
async (messages: MQMessage[]) => { async (messages: MQMessage[]) => {
try { try {