Skip to content

Commit

Permalink
feat: add exchange config var (#114)
Browse files Browse the repository at this point in the history
* feat: add a queue for processing retry messages

* feat: update params and config

* feat: fix condition

* feat: update queue var name

* feat: add exchange config var

* feat: fix linter error

* fix: config test
  • Loading branch information
pritamstyz4ever authored Jun 28, 2021
1 parent 42ac99b commit df03ed0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion config/custom-environment-variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ ecosystem:
rabbitmq:
# Protocol for rabbitmq server, use amqps for ssl
protocol: RABBITMQ_PROTOCOL
# User to pull from rabbitmq
# User to push and pull to anf from rabbitmq
username: RABBITMQ_USERNAME
# Password to connect to rabbitmq cluster
password: RABBITMQ_PASSWORD
Expand All @@ -350,6 +350,8 @@ rabbitmq:
retryQueue: RABBITMQ_RETRYQUEUE
# retry queue enable/disable flag
retryQueueEnabled: RABBITMQ_RETRYQUEUE_ENABLED
# Exchange / router name for rabbitmq
exchange: RABBITMQ_EXCHANGE
httpd:
# Port to listen on
port: PORT
Expand Down
2 changes: 2 additions & 0 deletions config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ rabbitmq:
retryQueue: sdRetryQueue
# retry queue enable/disable flag
retryQueueEnabled: true
# Exchange / router name for rabbitmq
exchange: build
httpd:
# Port to listen on
port: 80
Expand Down
9 changes: 6 additions & 3 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ const rabbitmqConfig = config.get('rabbitmq');
const ecosystemConfig = config.get('ecosystem');

const { strategy, path } = ecosystemConfig.cache;
const { protocol, username, password, host, port, vhost, connectOptions,
queue, prefetchCount, messageReprocessLimit, retryQueue, retryQueueEnabled } = rabbitmqConfig;
const { protocol, username, password, host,
port, vhost, connectOptions,
queue, prefetchCount, messageReprocessLimit,
retryQueue, retryQueueEnabled, exchange } = rabbitmqConfig;
const amqpURI = `${protocol}://${username}:${password}@${host}:${port}${vhost}`;

/**
Expand All @@ -26,7 +28,8 @@ function getConfig() {
cacheStrategy: strategy,
cachePath: path,
retryQueue,
retryQueueEnabled
retryQueueEnabled,
exchange
};
}

Expand Down
6 changes: 4 additions & 2 deletions test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ describe('config test', () => {
prefetchCount: 20,
messageReprocessLimit: 3,
retryQueue: 'sdRetryQueue',
retryQueueEnabled: true
retryQueueEnabled: true,
exchange: 'build'
}
};

Expand All @@ -48,7 +49,8 @@ describe('config test', () => {
cacheStrategy: configDef.ecosystem.cache.strategy,
cachePath: configDef.ecosystem.cache.path,
retryQueue: configDef.rabbitmq.retryQueue,
retryQueueEnabled: configDef.rabbitmq.retryQueueEnabled
retryQueueEnabled: configDef.rabbitmq.retryQueueEnabled,
exchange: configDef.rabbitmq.exchange
});
});
});

0 comments on commit df03ed0

Please sign in to comment.