@diia-inhouse/diia-queue 14.1.0 → 14.1.1

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.
@@ -135,14 +135,14 @@ var Communicator = class {
135
135
  unifyServiceConfig(listeners, implicitExchangesOptions = []) {
136
136
  const queuesMap = /* @__PURE__ */ new Map();
137
137
  const exchangesMap = /* @__PURE__ */ new Map();
138
+ const { queuesOptions, exchangesOptions: explicitExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
139
+ for (const exchangeOpts of [...explicitExchangesOptions, ...implicitExchangesOptions]) if (!exchangesMap.has(exchangeOpts.name)) exchangesMap.set(exchangeOpts.name, exchangeOpts);
138
140
  for (const listener of listeners) {
139
141
  const { queueOptions, exchangesOptions } = listener;
140
142
  queuesMap.set(queueOptions.name, queueOptions);
141
- for (const exchangeOptions of exchangesOptions) exchangesMap.set(exchangeOptions.name, exchangeOptions);
143
+ for (const exchangeOptions of exchangesOptions) if (!exchangesMap.has(exchangeOptions.name)) exchangesMap.set(exchangeOptions.name, exchangeOptions);
142
144
  }
143
- const { queuesOptions, exchangesOptions: explicitExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
144
145
  for (const queueOpts of queuesOptions) if (!queuesMap.has(queueOpts.name)) queuesMap.set(queueOpts.name, queueOpts);
145
- for (const exchangeOpts of [...explicitExchangesOptions, ...implicitExchangesOptions]) if (!exchangesMap.has(exchangeOpts.name)) exchangesMap.set(exchangeOpts.name, exchangeOpts);
146
146
  return {
147
147
  queuesOptions: [...queuesMap.values()],
148
148
  exchangesOptions: [...exchangesMap.values()]
@@ -25,15 +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 globalExchangeNames = this.optionsBuilder.getExchangeNamesByQueueName(this.queueName);
29
- const globalExchangesOptions = [];
30
- for (const globalExchangeName of globalExchangeNames) globalExchangesOptions.push({
31
- name: globalExchangeName,
28
+ const exchangeNames = this.optionsBuilder.getExchangeNamesByQueueName(this.queueName);
29
+ const exchangesOptions = [];
30
+ for (const exchangeName of exchangeNames) exchangesOptions.push({
31
+ name: exchangeName,
32
32
  declare: assertExchanges,
33
- type: "topic"
33
+ type: "topic",
34
+ bindTo: []
34
35
  });
35
- const { exchangesOptions: messageBrokerServiceConfigExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
36
- return [...globalExchangesOptions, ...messageBrokerServiceConfigExchangesOptions];
36
+ return exchangesOptions;
37
37
  }
38
38
  getMulticastListeners() {
39
39
  if (!this.queueName || this.eventListenerList.length === 0) return [];
@@ -64,9 +64,8 @@ var ExternalEventBus = class ExternalEventBus extends Communicator {
64
64
  return `${this.exchangePrefixName}${topic}`;
65
65
  }
66
66
  getProducerExchangesOptions() {
67
- const [globalExchangesOptions] = this.defineQueuesAndExchangesOptionsBasedOnGlobalConfig();
68
- const { exchangesOptions: messageBrokerServiceConfigExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
69
- return [...globalExchangesOptions, ...messageBrokerServiceConfigExchangesOptions];
67
+ const [exchangesOptions] = this.defineQueuesAndExchangesOptionsBasedOnGlobalConfig();
68
+ return exchangesOptions;
70
69
  }
71
70
  getMulticastListeners() {
72
71
  const [exchangesOptions, queuesOptions] = this.defineQueuesAndExchangesOptionsBasedOnGlobalConfig();
@@ -123,7 +122,8 @@ var ExternalEventBus = class ExternalEventBus extends Communicator {
123
122
  const exchangeOptions = {
124
123
  name: exchangeName,
125
124
  type: "topic",
126
- declare: assertExchanges
125
+ declare: assertExchanges,
126
+ bindTo: []
127
127
  };
128
128
  exchangesMap.set(exchangeName, exchangeOptions);
129
129
  }
@@ -38,21 +38,21 @@ var ScheduledTask = class extends Communicator {
38
38
  return this.eventCommunicator.getMulticastListeners([queueOptions], exchangesOptions);
39
39
  }
40
40
  getProducerExchangesOptions() {
41
- const globalExchangesOptions = [];
41
+ const exchangesOptions = [];
42
42
  const { topics = {}, rabbit: { declareOptions: { assertExchanges } = {} } } = this.queueProvider.getConfig();
43
43
  const createExchangeOptions = (exchangeName) => ({
44
44
  name: exchangeName,
45
45
  type: "topic",
46
- declare: assertExchanges
46
+ declare: assertExchanges,
47
+ bindTo: []
47
48
  });
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);
49
+ const exchangeNamesByQueueName = this.optionsBuilder.getExchangeNamesByQueueName(this.queueName);
50
+ const exchangeNamesSet = new Set([...Object.keys(topics), ...exchangeNamesByQueueName]);
51
+ for (const exchangeName of exchangeNamesSet) {
52
+ const exchangeOptions = createExchangeOptions(exchangeName);
53
+ exchangesOptions.push(exchangeOptions);
53
54
  }
54
- const { exchangesOptions: messageBrokerServiceConfigExchangesOptions } = this.queueProvider.getMessageBrokerServiceConfig();
55
- return [...globalExchangesOptions, ...messageBrokerServiceConfigExchangesOptions];
55
+ return exchangesOptions;
56
56
  }
57
57
  getRoutingKey(serviceName) {
58
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.1.0",
3
+ "version": "14.1.1",
4
4
  "type": "module",
5
5
  "description": "Package provide queue functionality",
6
6
  "main": "dist/index.js",