@diia-inhouse/diia-queue 14.0.30 → 14.1.0

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.
@@ -25,14 +25,15 @@ var EventBus = class extends Communicator {
25
25
  getProducerExchangesOptions() {
26
26
  if (!this.queueName) return [];
27
27
  const { rabbit: { declareOptions: { assertExchanges } = {} } } = this.queueProvider.getConfig();
28
- const exchangeNames = this.optionsBuilder.getExchangeNamesByQueueName(this.queueName);
29
- const exchangesOptions = [];
30
- for (const exchangeName of exchangeNames) exchangesOptions.push({
31
- name: exchangeName,
28
+ const globalExchangeNames = this.optionsBuilder.getExchangeNamesByQueueName(this.queueName);
29
+ const globalExchangesOptions = [];
30
+ for (const globalExchangeName of globalExchangeNames) globalExchangesOptions.push({
31
+ name: globalExchangeName,
32
32
  declare: assertExchanges,
33
33
  type: "topic"
34
34
  });
35
- return exchangesOptions;
35
+ const { exchangesOptions: messageBrokerServiceConfigExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
36
+ return [...globalExchangesOptions, ...messageBrokerServiceConfigExchangesOptions];
36
37
  }
37
38
  getMulticastListeners() {
38
39
  if (!this.queueName || this.eventListenerList.length === 0) return [];
@@ -18,8 +18,10 @@ var EventCommunicator = class {
18
18
  const listeners = [];
19
19
  for (const queueOptions of queuesOptions) {
20
20
  const { name: queueName } = queueOptions;
21
+ const eventNames = this.defineEventNamesByQueueName(queueName, eventQueueMap);
22
+ if (!this.listenerList.some(({ queueNames = [], event }) => queueNames.includes(queueName) || eventNames.includes(event))) continue;
21
23
  const listener = {
22
- eventNames: this.defineEventNamesByQueueName(queueName, eventQueueMap),
24
+ eventNames,
23
25
  queueOptions,
24
26
  exchangesOptions,
25
27
  handler: eventsHandler
@@ -64,8 +64,9 @@ var ExternalEventBus = class ExternalEventBus extends Communicator {
64
64
  return `${this.exchangePrefixName}${topic}`;
65
65
  }
66
66
  getProducerExchangesOptions() {
67
- const [exchangesOptions] = this.defineQueuesAndExchangesOptionsBasedOnGlobalConfig();
68
- return exchangesOptions;
67
+ const [globalExchangesOptions] = this.defineQueuesAndExchangesOptionsBasedOnGlobalConfig();
68
+ const { exchangesOptions: messageBrokerServiceConfigExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
69
+ return [...globalExchangesOptions, ...messageBrokerServiceConfigExchangesOptions];
69
70
  }
70
71
  getMulticastListeners() {
71
72
  const [exchangesOptions, queuesOptions] = this.defineQueuesAndExchangesOptionsBasedOnGlobalConfig();
@@ -38,20 +38,21 @@ var ScheduledTask = class extends Communicator {
38
38
  return this.eventCommunicator.getMulticastListeners([queueOptions], exchangesOptions);
39
39
  }
40
40
  getProducerExchangesOptions() {
41
- const exchangesOptions = [];
41
+ const globalExchangesOptions = [];
42
42
  const { topics = {}, rabbit: { declareOptions: { assertExchanges } = {} } } = this.queueProvider.getConfig();
43
43
  const createExchangeOptions = (exchangeName) => ({
44
44
  name: exchangeName,
45
45
  type: "topic",
46
46
  declare: assertExchanges
47
47
  });
48
- const exchangeNamesByQueueName = this.optionsBuilder.getExchangeNamesByQueueName(this.queueName);
49
- const exchangeNamesSet = new Set([...Object.keys(topics), ...exchangeNamesByQueueName]);
50
- for (const exchangeName of exchangeNamesSet) {
51
- const exchangeOptions = createExchangeOptions(exchangeName);
52
- exchangesOptions.push(exchangeOptions);
48
+ const globalExchangeNamesByQueueName = this.optionsBuilder.getExchangeNamesByQueueName(this.queueName);
49
+ const globalExchangeNamesSet = new Set([...Object.keys(topics), ...globalExchangeNamesByQueueName]);
50
+ for (const globalExchangeName of globalExchangeNamesSet) {
51
+ const exchangeOptions = createExchangeOptions(globalExchangeName);
52
+ globalExchangesOptions.push(exchangeOptions);
53
53
  }
54
- return exchangesOptions;
54
+ const { exchangesOptions: messageBrokerServiceConfigExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
55
+ return [...globalExchangesOptions, ...messageBrokerServiceConfigExchangesOptions];
55
56
  }
56
57
  getRoutingKey(serviceName) {
57
58
  return `${serviceName}.${this.eventRoutingPart}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diia-inhouse/diia-queue",
3
- "version": "14.0.30",
3
+ "version": "14.1.0",
4
4
  "type": "module",
5
5
  "description": "Package provide queue functionality",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "scripts": {
25
25
  "build": "rimraf dist/ && tsdown",
26
- "build-watch": "tsdown --watch",
26
+ "build:watch": "tsdown --watch",
27
27
  "lint": "oxlint && oxfmt --check .",
28
28
  "lint-fix": "oxlint --fix && oxfmt .",
29
29
  "lint:lockfile": "lockfile-lint --path package-lock.json --allowed-hosts registry.npmjs.org --validate-https",
@@ -51,15 +51,15 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@diia-inhouse/configs": "7.0.1",
54
- "@diia-inhouse/diia-logger": "4.4.0",
55
- "@diia-inhouse/diia-metrics": "7.1.39",
56
- "@diia-inhouse/env": "3.3.23",
57
- "@diia-inhouse/errors": "2.1.20",
54
+ "@diia-inhouse/diia-logger": "4.4.6",
55
+ "@diia-inhouse/diia-metrics": "7.1.44",
56
+ "@diia-inhouse/env": "3.3.28",
57
+ "@diia-inhouse/errors": "2.2.2",
58
58
  "@diia-inhouse/oxc-config": "2.0.0",
59
- "@diia-inhouse/test": "8.2.14",
60
- "@diia-inhouse/types": "14.1.0",
61
- "@diia-inhouse/utils": "6.0.38",
62
- "@diia-inhouse/validators": "2.2.29",
59
+ "@diia-inhouse/test": "8.2.17",
60
+ "@diia-inhouse/types": "14.1.1",
61
+ "@diia-inhouse/utils": "6.0.42",
62
+ "@diia-inhouse/validators": "2.2.33",
63
63
  "@opentelemetry/api": "1.9.0",
64
64
  "@types/lodash": "4.17.24",
65
65
  "@types/node": "25.6.2",