Skip to content

Commit

Permalink
Merge pull request #9148 from hicommonwealth/tim/optional-rmq-purge
Browse files Browse the repository at this point in the history
  • Loading branch information
timolegros authored Sep 9, 2024
2 parents 255c21d + 15abce8 commit d39539a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libs/adapters/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {
SEND_WEBHOOKS,
SEND_WEBHOOKS_CONFIRMATION_TIMESTAMP,
SEND_EMAILS,
DISABLE_LOCAL_QUEUE_PURGE,
} = process.env;

export const config = configure(
Expand All @@ -42,6 +43,7 @@ export const config = configure(
},
BROKER: {
RABBITMQ_URI: CLOUDAMQP_URL ?? DEFAULTS.RABBITMQ_URI,
DISABLE_LOCAL_QUEUE_PURGE: DISABLE_LOCAL_QUEUE_PURGE === 'true',
},
NOTIFICATIONS: {
FLAG_KNOCK_INTEGRATION_ENABLED:
Expand Down Expand Up @@ -95,6 +97,11 @@ export const config = configure(
data === DEFAULTS.RABBITMQ_URI
);
}, 'RABBITMQ_URI is require in production, beta (QA), demo, and frick Heroku apps'),
DISABLE_LOCAL_QUEUE_PURGE: z
.boolean()
.describe(
'Disable purging all messages in queues when a consumer starts up',
),
}),
NOTIFICATIONS: z
.object({
Expand Down
3 changes: 2 additions & 1 deletion libs/adapters/src/rabbitmq/rabbitMQConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Rascal from 'rascal';
import { config as EnvConfig } from '../config';
import { getAllRascalConfigs } from './configuration/rascalConfig';
import {
RascalBindings,
Expand Down Expand Up @@ -31,7 +32,7 @@ export function getRabbitMQConfig(
rabbitmq_uri.includes('127.0.0.1')
) {
vhost = '/';
purge = true;
purge = !EnvConfig.BROKER.DISABLE_LOCAL_QUEUE_PURGE;
} else {
const count = (rabbitmq_uri.match(/\//g) || []).length;
if (count == 3) {
Expand Down

0 comments on commit d39539a

Please sign in to comment.