@diia-inhouse/diia-queue 13.3.4 → 14.0.11
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/dist/constants.js +9 -9
- package/dist/index.d.ts +27 -0
- package/dist/index.js +23 -21
- package/dist/interfaces/deps.d.ts +30 -0
- package/dist/interfaces/externalCommunicator.d.ts +58 -0
- package/dist/interfaces/index.d.ts +95 -0
- package/dist/interfaces/index.js +7 -30
- package/dist/interfaces/messageBrokerServiceConfig.d.ts +80 -0
- package/dist/interfaces/messageBrokerServiceConfig.js +27 -24
- package/dist/interfaces/messageHandler.d.ts +6 -0
- package/dist/interfaces/metrics/index.d.ts +23 -0
- package/dist/interfaces/metrics/index.js +12 -16
- package/dist/interfaces/options.d.ts +52 -0
- package/dist/interfaces/providers/rabbitmq/amqpConnection.d.ts +33 -0
- package/dist/interfaces/providers/rabbitmq/amqpConnection.js +14 -17
- package/dist/interfaces/providers/rabbitmq/amqpPublisher.d.ts +20 -0
- package/dist/interfaces/providers/rabbitmq/index.d.ts +107 -0
- package/dist/interfaces/providers/rabbitmq/index.js +35 -47
- package/dist/interfaces/queueConfig/configs.d.ts +47 -0
- package/dist/interfaces/queueConfig/configs.js +8 -9
- package/dist/interfaces/queueConfig/index.d.ts +1 -0
- package/dist/interfaces/queueContext.d.ts +8 -0
- package/dist/interfaces/queueStatus.d.ts +15 -0
- package/dist/interfaces/queueStatus.js +8 -9
- package/dist/metrics/index.js +5 -8
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +6 -22
- package/dist/providers/rabbitmq/amqpAsserter.d.ts +53 -0
- package/dist/providers/rabbitmq/amqpAsserter.js +369 -416
- package/dist/providers/rabbitmq/amqpConnection.d.ts +24 -0
- package/dist/providers/rabbitmq/amqpConnection.js +97 -150
- package/dist/providers/rabbitmq/amqpListener.d.ts +47 -0
- package/dist/providers/rabbitmq/amqpListener.js +218 -225
- package/dist/providers/rabbitmq/amqpPublisher.d.ts +38 -0
- package/dist/providers/rabbitmq/amqpPublisher.js +184 -191
- package/dist/providers/rabbitmq/index.d.ts +56 -0
- package/dist/providers/rabbitmq/index.js +161 -186
- package/dist/services/communicator.d.ts +66 -0
- package/dist/services/communicator.js +164 -186
- package/dist/services/eventBus.d.ts +25 -0
- package/dist/services/eventBus.js +45 -57
- package/dist/services/eventCommunicator.js +75 -124
- package/dist/services/eventMessageHandler.d.ts +27 -0
- package/dist/services/eventMessageHandler.js +124 -129
- package/dist/services/eventMessageValidator.d.ts +13 -0
- package/dist/services/eventMessageValidator.js +59 -44
- package/dist/services/externalCommunicator.d.ts +114 -0
- package/dist/services/externalCommunicator.js +149 -140
- package/dist/services/externalEventBus.d.ts +39 -0
- package/dist/services/externalEventBus.js +144 -162
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.js +10 -26
- package/dist/services/metrics.d.ts +15 -0
- package/dist/services/metrics.js +46 -49
- package/dist/services/optionsBuilder.d.ts +14 -0
- package/dist/services/optionsBuilder.js +43 -58
- package/dist/services/queue.d.ts +29 -0
- package/dist/services/queue.js +78 -93
- package/dist/services/scheduledTask.d.ts +30 -0
- package/dist/services/scheduledTask.js +60 -68
- package/dist/services/task.d.ts +33 -0
- package/dist/services/task.js +160 -176
- package/dist/utils.js +7 -11
- package/package.json +44 -50
- package/dist/constants.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interfaces/deps.js +0 -3
- package/dist/interfaces/deps.js.map +0 -1
- package/dist/interfaces/externalCommunicator.js +0 -3
- package/dist/interfaces/externalCommunicator.js.map +0 -1
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/messageBrokerServiceConfig.js.map +0 -1
- package/dist/interfaces/messageHandler.js +0 -3
- package/dist/interfaces/messageHandler.js.map +0 -1
- package/dist/interfaces/metrics/index.js.map +0 -1
- package/dist/interfaces/options.js +0 -3
- package/dist/interfaces/options.js.map +0 -1
- package/dist/interfaces/providers/rabbitmq/amqpConnection.js.map +0 -1
- package/dist/interfaces/providers/rabbitmq/amqpPublisher.js +0 -4
- package/dist/interfaces/providers/rabbitmq/amqpPublisher.js.map +0 -1
- package/dist/interfaces/providers/rabbitmq/index.js.map +0 -1
- package/dist/interfaces/queueConfig/configs.js.map +0 -1
- package/dist/interfaces/queueConfig/index.js +0 -18
- package/dist/interfaces/queueConfig/index.js.map +0 -1
- package/dist/interfaces/queueContext.js +0 -3
- package/dist/interfaces/queueContext.js.map +0 -1
- package/dist/interfaces/queueStatus.js.map +0 -1
- package/dist/interfaces/services/eventMessageHandler.js +0 -3
- package/dist/interfaces/services/eventMessageHandler.js.map +0 -1
- package/dist/metrics/index.js.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/rabbitmq/amqpAsserter.js.map +0 -1
- package/dist/providers/rabbitmq/amqpConnection.js.map +0 -1
- package/dist/providers/rabbitmq/amqpListener.js.map +0 -1
- package/dist/providers/rabbitmq/amqpPublisher.js.map +0 -1
- package/dist/providers/rabbitmq/index.js.map +0 -1
- package/dist/services/communicator.js.map +0 -1
- package/dist/services/eventBus.js.map +0 -1
- package/dist/services/eventCommunicator.js.map +0 -1
- package/dist/services/eventMessageHandler.js.map +0 -1
- package/dist/services/eventMessageValidator.js.map +0 -1
- package/dist/services/externalCommunicator.js.map +0 -1
- package/dist/services/externalEventBus.js.map +0 -1
- package/dist/services/index.js.map +0 -1
- package/dist/services/metrics.js.map +0 -1
- package/dist/services/optionsBuilder.js.map +0 -1
- package/dist/services/queue.js.map +0 -1
- package/dist/services/scheduledTask.js.map +0 -1
- package/dist/services/task.js.map +0 -1
- package/dist/types/constants.d.ts +0 -8
- package/dist/types/index.d.ts +0 -4
- package/dist/types/interfaces/deps.d.ts +0 -26
- package/dist/types/interfaces/externalCommunicator.d.ts +0 -54
- package/dist/types/interfaces/index.d.ts +0 -99
- package/dist/types/interfaces/messageBrokerServiceConfig.d.ts +0 -79
- package/dist/types/interfaces/messageHandler.d.ts +0 -2
- package/dist/types/interfaces/metrics/index.d.ts +0 -20
- package/dist/types/interfaces/options.d.ts +0 -49
- package/dist/types/interfaces/providers/rabbitmq/amqpConnection.d.ts +0 -29
- package/dist/types/interfaces/providers/rabbitmq/amqpPublisher.d.ts +0 -16
- package/dist/types/interfaces/providers/rabbitmq/index.d.ts +0 -114
- package/dist/types/interfaces/queueConfig/configs.d.ts +0 -47
- package/dist/types/interfaces/queueConfig/index.d.ts +0 -1
- package/dist/types/interfaces/queueContext.d.ts +0 -4
- package/dist/types/interfaces/queueStatus.d.ts +0 -11
- package/dist/types/interfaces/services/eventMessageHandler.d.ts +0 -5
- package/dist/types/metrics/index.d.ts +0 -3
- package/dist/types/providers/index.d.ts +0 -5
- package/dist/types/providers/rabbitmq/amqpAsserter.d.ts +0 -49
- package/dist/types/providers/rabbitmq/amqpConnection.d.ts +0 -20
- package/dist/types/providers/rabbitmq/amqpListener.d.ts +0 -42
- package/dist/types/providers/rabbitmq/amqpPublisher.d.ts +0 -34
- package/dist/types/providers/rabbitmq/index.d.ts +0 -52
- package/dist/types/services/communicator.d.ts +0 -57
- package/dist/types/services/eventBus.d.ts +0 -20
- package/dist/types/services/eventCommunicator.d.ts +0 -15
- package/dist/types/services/eventMessageHandler.d.ts +0 -19
- package/dist/types/services/eventMessageValidator.d.ts +0 -9
- package/dist/types/services/externalCommunicator.d.ts +0 -110
- package/dist/types/services/externalEventBus.d.ts +0 -33
- package/dist/types/services/index.d.ts +0 -9
- package/dist/types/services/metrics.d.ts +0 -11
- package/dist/types/services/optionsBuilder.d.ts +0 -10
- package/dist/types/services/queue.d.ts +0 -23
- package/dist/types/services/scheduledTask.d.ts +0 -25
- package/dist/types/services/task.d.ts +0 -28
- package/dist/types/utils.d.ts +0 -3
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConnectionStatus, ReconnectOptions, SocketOptions } from "../../interfaces/providers/rabbitmq/amqpConnection.js";
|
|
2
|
+
import { Logger } from "@diia-inhouse/types";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
import { Channel, Options } from "amqplib";
|
|
5
|
+
|
|
6
|
+
//#region src/providers/rabbitmq/amqpConnection.d.ts
|
|
7
|
+
declare class AmqpConnection extends EventEmitter {
|
|
8
|
+
private readonly connectOptions;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private readonly reconnectOptions;
|
|
11
|
+
private readonly socketOptions;
|
|
12
|
+
private reconnectEnabled;
|
|
13
|
+
private reconnectTimeout;
|
|
14
|
+
private connection?;
|
|
15
|
+
private connectionStatus;
|
|
16
|
+
constructor(connectOptions: Options.Connect, logger: Logger, reconnectOptions?: ReconnectOptions | undefined, socketOptions?: SocketOptions);
|
|
17
|
+
connect(): Promise<void>;
|
|
18
|
+
createChannel(queueName?: string): Promise<Channel>;
|
|
19
|
+
reconnect(): Promise<void>;
|
|
20
|
+
closeConnection(): Promise<void>;
|
|
21
|
+
getStatus(): ConnectionStatus;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { AmqpConnection };
|
|
@@ -1,151 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
import "../../interfaces/providers/rabbitmq/amqpConnection.js";
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import { setTimeout } from "node:timers/promises";
|
|
5
|
+
import { connect } from "amqplib";
|
|
6
|
+
//#region src/providers/rabbitmq/amqpConnection.ts
|
|
7
|
+
const defaultSocketOptions = { clientProperties: { hostname: os.hostname() } };
|
|
8
|
+
const defaultReconnectTimeoutMs = 5e3;
|
|
9
|
+
var AmqpConnection = class extends EventEmitter {
|
|
10
|
+
connectOptions;
|
|
11
|
+
logger;
|
|
12
|
+
reconnectOptions;
|
|
13
|
+
socketOptions;
|
|
14
|
+
reconnectEnabled = false;
|
|
15
|
+
reconnectTimeout = defaultReconnectTimeoutMs;
|
|
16
|
+
connection;
|
|
17
|
+
connectionStatus = "init";
|
|
18
|
+
constructor(connectOptions, logger, reconnectOptions = void 0, socketOptions = defaultSocketOptions) {
|
|
19
|
+
super();
|
|
20
|
+
this.connectOptions = connectOptions;
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
this.reconnectOptions = reconnectOptions;
|
|
23
|
+
this.socketOptions = socketOptions;
|
|
24
|
+
if (this.reconnectOptions) {
|
|
25
|
+
const { reconnectEnabled, reconnectTimeout } = this.reconnectOptions;
|
|
26
|
+
this.reconnectEnabled = reconnectEnabled || this.reconnectEnabled;
|
|
27
|
+
this.reconnectTimeout = reconnectTimeout || this.reconnectTimeout;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async connect() {
|
|
31
|
+
this.connectionStatus = "connecting";
|
|
32
|
+
try {
|
|
33
|
+
this.connection = await connect(this.connectOptions, this.socketOptions);
|
|
34
|
+
this.connectionStatus = "connected";
|
|
35
|
+
this.logger.info("Connection to RabbitMQ is created");
|
|
36
|
+
this.logger.info("Connection is ready");
|
|
37
|
+
this.emit("ready");
|
|
38
|
+
this.connection?.on("close", async () => {
|
|
39
|
+
this.connectionStatus = "closed";
|
|
40
|
+
if (this.reconnectEnabled) {
|
|
41
|
+
await this.reconnect();
|
|
42
|
+
this.logger.warn("Successful reconnect");
|
|
43
|
+
} else this.logger.warn("Reconnect is disabled in config");
|
|
44
|
+
});
|
|
45
|
+
this.connection?.on("error", async (err) => {
|
|
46
|
+
this.logger.error("Connection error", { err });
|
|
47
|
+
});
|
|
48
|
+
} catch (err) {
|
|
49
|
+
this.logger.error("Creating connection to Rabbit MQ error", { err });
|
|
50
|
+
if (this.reconnectEnabled) {
|
|
51
|
+
await this.reconnect();
|
|
52
|
+
this.logger.warn("Successful reconnect");
|
|
53
|
+
} else throw err;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async createChannel(queueName) {
|
|
57
|
+
this.logger.info("Creating channel to RabbitMQ...", { queueName });
|
|
58
|
+
if (!this.connection) throw new Error("RabbitMQ connection is not initialized");
|
|
59
|
+
try {
|
|
60
|
+
const channel = await this.connection.createChannel();
|
|
61
|
+
channel.on("cancel", (consumerTag) => {
|
|
62
|
+
this.logger.info(`Consumer with tag ${consumerTag} was cancelled.`);
|
|
63
|
+
});
|
|
64
|
+
channel.on("close", async () => {
|
|
65
|
+
this.logger.info("Channel was closed.");
|
|
66
|
+
});
|
|
67
|
+
channel.on("error", (err) => {
|
|
68
|
+
this.logger.error("Channel on error", { err });
|
|
69
|
+
});
|
|
70
|
+
this.logger.info("Channel to RabbitMQ is created", { queueName });
|
|
71
|
+
return channel;
|
|
72
|
+
} catch (err) {
|
|
73
|
+
this.logger.error("Creating channel to Rabbit MQ error", { err });
|
|
74
|
+
if (this.reconnectEnabled) {
|
|
75
|
+
await this.reconnect();
|
|
76
|
+
return await this.createChannel(queueName);
|
|
77
|
+
}
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async reconnect() {
|
|
82
|
+
this.connectionStatus = "reconnecting";
|
|
83
|
+
this.logger.info(`Try to reconnect to Rabbit MQ in ${this.reconnectTimeout} ms`);
|
|
84
|
+
await setTimeout(this.reconnectTimeout);
|
|
85
|
+
await this.connect();
|
|
86
|
+
}
|
|
87
|
+
async closeConnection() {
|
|
88
|
+
if (!this.connection) return;
|
|
89
|
+
this.connectionStatus = "closing";
|
|
90
|
+
await this.connection?.close();
|
|
91
|
+
this.logger.info("Connection was closed");
|
|
92
|
+
}
|
|
93
|
+
getStatus() {
|
|
94
|
+
return this.connectionStatus;
|
|
95
|
+
}
|
|
45
96
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class AmqpConnection extends node_events_1.EventEmitter {
|
|
49
|
-
connectOptions;
|
|
50
|
-
logger;
|
|
51
|
-
reconnectOptions;
|
|
52
|
-
socketOptions;
|
|
53
|
-
reconnectEnabled = false;
|
|
54
|
-
reconnectTimeout = defaultReconnectTimeoutMs;
|
|
55
|
-
connection;
|
|
56
|
-
connectionStatus = amqpConnection_1.ConnectionStatus.Init;
|
|
57
|
-
constructor(connectOptions, logger, reconnectOptions, socketOptions = defaultSocketOptions) {
|
|
58
|
-
super();
|
|
59
|
-
this.connectOptions = connectOptions;
|
|
60
|
-
this.logger = logger;
|
|
61
|
-
this.reconnectOptions = reconnectOptions;
|
|
62
|
-
this.socketOptions = socketOptions;
|
|
63
|
-
if (this.reconnectOptions) {
|
|
64
|
-
const { reconnectEnabled, reconnectTimeout } = this.reconnectOptions;
|
|
65
|
-
this.reconnectEnabled = reconnectEnabled || this.reconnectEnabled;
|
|
66
|
-
this.reconnectTimeout = reconnectTimeout || this.reconnectTimeout;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async connect() {
|
|
70
|
-
this.connectionStatus = amqpConnection_1.ConnectionStatus.Connecting;
|
|
71
|
-
try {
|
|
72
|
-
this.connection = await (0, amqplib_1.connect)(this.connectOptions, this.socketOptions);
|
|
73
|
-
this.connectionStatus = amqpConnection_1.ConnectionStatus.Connected;
|
|
74
|
-
this.logger.info('Connection to RabbitMQ is created');
|
|
75
|
-
this.logger.info('Connection is ready');
|
|
76
|
-
this.emit('ready');
|
|
77
|
-
this.connection?.on('close', async () => {
|
|
78
|
-
this.connectionStatus = amqpConnection_1.ConnectionStatus.Closed;
|
|
79
|
-
if (this.reconnectEnabled) {
|
|
80
|
-
await this.reconnect();
|
|
81
|
-
this.logger.warn('Successful reconnect');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.logger.warn('Reconnect is disabled in config');
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
this.connection?.on('error', async (err) => {
|
|
88
|
-
this.logger.error('Connection error', { err });
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
this.logger.error('Creating connection to Rabbit MQ error', { err });
|
|
93
|
-
if (this.reconnectEnabled) {
|
|
94
|
-
await this.reconnect();
|
|
95
|
-
this.logger.warn('Successful reconnect');
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
throw err;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
async createChannel(queueName) {
|
|
103
|
-
this.logger.info('Creating channel to RabbitMQ...', { queueName });
|
|
104
|
-
if (!this.connection) {
|
|
105
|
-
throw new Error('RabbitMQ connection is not initialized');
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
const channel = await this.connection.createChannel();
|
|
109
|
-
channel.on('cancel', (consumerTag) => {
|
|
110
|
-
this.logger.info(`Consumer with tag ${consumerTag} was cancelled.`);
|
|
111
|
-
});
|
|
112
|
-
channel.on('close', async () => {
|
|
113
|
-
this.logger.info('Channel was closed.');
|
|
114
|
-
});
|
|
115
|
-
channel.on('error', (err) => {
|
|
116
|
-
this.logger.error('Channel on error', { err });
|
|
117
|
-
});
|
|
118
|
-
this.logger.info('Channel to RabbitMQ is created', { queueName });
|
|
119
|
-
return channel;
|
|
120
|
-
}
|
|
121
|
-
catch (err) {
|
|
122
|
-
this.logger.error('Creating channel to Rabbit MQ error', { err });
|
|
123
|
-
if (this.reconnectEnabled) {
|
|
124
|
-
await this.reconnect();
|
|
125
|
-
return await this.createChannel(queueName);
|
|
126
|
-
}
|
|
127
|
-
throw err;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
async reconnect() {
|
|
131
|
-
this.connectionStatus = amqpConnection_1.ConnectionStatus.Reconnecting;
|
|
132
|
-
this.logger.info(`Try to reconnect to Rabbit MQ in ${this.reconnectTimeout} ms`);
|
|
133
|
-
await new Promise((resolve) => {
|
|
134
|
-
setTimeout(resolve, this.reconnectTimeout);
|
|
135
|
-
});
|
|
136
|
-
await this.connect();
|
|
137
|
-
}
|
|
138
|
-
async closeConnection() {
|
|
139
|
-
if (!this.connection) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
this.connectionStatus = amqpConnection_1.ConnectionStatus.Closing;
|
|
143
|
-
await this.connection?.close();
|
|
144
|
-
this.logger.info('Connection was closed');
|
|
145
|
-
}
|
|
146
|
-
getStatus() {
|
|
147
|
-
return this.connectionStatus;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.AmqpConnection = AmqpConnection;
|
|
151
|
-
//# sourceMappingURL=amqpConnection.js.map
|
|
97
|
+
//#endregion
|
|
98
|
+
export { AmqpConnection };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { QueueOptions } from "../../interfaces/messageBrokerServiceConfig.js";
|
|
2
|
+
import { ConnectionStatus } from "../../interfaces/providers/rabbitmq/amqpConnection.js";
|
|
3
|
+
import { AmqpConnection } from "./amqpConnection.js";
|
|
4
|
+
import { QueueName } from "../../interfaces/queueConfig/configs.js";
|
|
5
|
+
import { MessageHandler } from "../../interfaces/messageHandler.js";
|
|
6
|
+
import { RabbitMQMetricsService } from "../../services/metrics.js";
|
|
7
|
+
import { Logger } from "@diia-inhouse/types";
|
|
8
|
+
|
|
9
|
+
//#region src/providers/rabbitmq/amqpListener.d.ts
|
|
10
|
+
declare class AmqpListener {
|
|
11
|
+
private connection;
|
|
12
|
+
private readonly logger;
|
|
13
|
+
private readonly rabbitMQMetrics;
|
|
14
|
+
private readonly queuesOptions;
|
|
15
|
+
private readonly systemServiceName;
|
|
16
|
+
private readonly infiniteRecreateChannelTriesCount;
|
|
17
|
+
private readonly defaultRecreateChannelOptions;
|
|
18
|
+
private readonly defaultPrefetchCount;
|
|
19
|
+
private queuesChannelsMap;
|
|
20
|
+
private queueRecreateChannelTriesMap;
|
|
21
|
+
private readonly defaultNackOptions;
|
|
22
|
+
private queuesCallbacksMap;
|
|
23
|
+
private queueConsumerOptionsMap;
|
|
24
|
+
private queueConsumerTagsMap;
|
|
25
|
+
private readonly nullMessage;
|
|
26
|
+
constructor(connection: AmqpConnection, logger: Logger, rabbitMQMetrics: RabbitMQMetricsService, queuesOptions: QueueOptions[] | undefined, systemServiceName: string);
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
cancelQueue(queueName: QueueName): Promise<void>;
|
|
29
|
+
listenQueue(queueName: QueueName, callback: MessageHandler): Promise<void>;
|
|
30
|
+
getStatus(): ConnectionStatus;
|
|
31
|
+
private ackMsg;
|
|
32
|
+
private nackMsg;
|
|
33
|
+
private createChannelAndListenQueue;
|
|
34
|
+
private saveQueueCallback;
|
|
35
|
+
private getQueueCallback;
|
|
36
|
+
private saveChannel;
|
|
37
|
+
private onMessageCallback;
|
|
38
|
+
private handleChannelError;
|
|
39
|
+
private parseMessage;
|
|
40
|
+
private prepareResponse;
|
|
41
|
+
private finishResponseProcessing;
|
|
42
|
+
private getConsumerOptions;
|
|
43
|
+
private getQueueChannel;
|
|
44
|
+
private saveConsumerTag;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { AmqpListener };
|