@onlineapps/conn-infra-mq 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -165,24 +165,18 @@ class RabbitMQClient extends EventEmitter {
|
|
|
165
165
|
|
|
166
166
|
// Try to assert queue with our config
|
|
167
167
|
// If it fails with 406 (PRECONDITION-FAILED), queue exists with different args - use it as-is
|
|
168
|
+
// IMPORTANT: Don't try to re-assert after 406, as it will close the channel
|
|
168
169
|
try {
|
|
169
170
|
await this._channel.assertQueue(queue, queueOptions);
|
|
170
171
|
} catch (assertErr) {
|
|
171
|
-
// If queue exists with different arguments (406), use it as-is
|
|
172
|
+
// If queue exists with different arguments (406), use it as-is without re-asserting
|
|
173
|
+
// Re-asserting would close the channel, so we just log and proceed to consume
|
|
172
174
|
if (assertErr.code === 406) {
|
|
173
|
-
console.warn(`[RabbitMQClient] Queue ${queue} exists with different arguments, using as-is:`, assertErr.message);
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
await this._channel.assertQueue(queue, { durable: durable !== false });
|
|
177
|
-
} catch (minErr) {
|
|
178
|
-
// If even minimal assert fails, queue might not exist - log and proceed
|
|
179
|
-
console.warn(`[RabbitMQClient] Could not assert queue ${queue} with minimal options:`, minErr.message);
|
|
180
|
-
}
|
|
181
|
-
} else if (assertErr.code === 404) {
|
|
182
|
-
// Queue doesn't exist - this shouldn't happen with assertQueue, but handle it
|
|
183
|
-
throw assertErr;
|
|
175
|
+
console.warn(`[RabbitMQClient] Queue ${queue} exists with different arguments, using as-is (skipping assert to avoid channel close):`, assertErr.message);
|
|
176
|
+
// Don't try to re-assert - just proceed to consume
|
|
177
|
+
// The queue exists, we just can't change its arguments
|
|
184
178
|
} else {
|
|
185
|
-
// Other error
|
|
179
|
+
// Other error (404 shouldn't happen with assertQueue, but handle it)
|
|
186
180
|
throw assertErr;
|
|
187
181
|
}
|
|
188
182
|
}
|