(
services: ExperimentalService[],
private getServiceOrigin: (name: string) => string | null
)
| 93 | private tickTimer: ReturnType<typeof setInterval>; |
| 94 | |
| 95 | constructor( |
| 96 | services: ExperimentalService[], |
| 97 | private getServiceOrigin: (name: string) => string | null |
| 98 | ) { |
| 99 | for (const service of services) { |
| 100 | if (!isQueueBackedService(service)) continue; |
| 101 | |
| 102 | const topicConfigs = getServiceQueueTopicConfigs(service); |
| 103 | for (const topicConfig of topicConfigs) { |
| 104 | const topicPattern = topicConfig.topic; |
| 105 | const id = `${service.name}::${topicPattern}`; |
| 106 | const group: ConsumerGroup = { |
| 107 | id, |
| 108 | name: service.name, |
| 109 | topicPattern, |
| 110 | topicRegex: topicPatternToRegex(topicPattern), |
| 111 | serviceOriginFn: () => this.getServiceOrigin(service.name), |
| 112 | retryAfterMs: |
| 113 | topicConfig.retryAfterSeconds !== undefined |
| 114 | ? topicConfig.retryAfterSeconds * 1000 |
| 115 | : DEFAULT_RETRY_AFTER, |
| 116 | maxDeliveries: DEFAULT_MAX_DELIVERIES, |
| 117 | initialDelayMs: |
| 118 | topicConfig.initialDelaySeconds !== undefined |
| 119 | ? topicConfig.initialDelaySeconds * 1000 |
| 120 | : DEFAULT_INITIAL_DELAY, |
| 121 | }; |
| 122 | |
| 123 | this.consumerGroups.push(group); |
| 124 | this.deliveryState.set(group.id, new Map()); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | this.tickTimer = setInterval(() => this.tick(), TICK_INTERVAL); |
| 129 | this.tickTimer.unref(); |
| 130 | } |
| 131 | |
| 132 | enqueue( |
| 133 | queueName: string, |
nothing calls this directly
no test coverage detected