amqp-extension 3.1.0 → 3.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.
- package/CHANGELOG.md +7 -0
- package/dist/module.d.ts +2 -1
- package/dist/module.js +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.1.1](https://github.com/Tada5hi/amqp-extension/compare/v3.1.0...v3.1.1) (2024-03-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* don't register consumer multiple times ([b45defa](https://github.com/Tada5hi/amqp-extension/commit/b45defa4dbd5a7abf6d2568586e2ff5bf2e62d16))
|
|
7
|
+
|
|
1
8
|
# [3.1.0](https://github.com/Tada5hi/amqp-extension/compare/v3.0.0...v3.1.0) (2024-03-06)
|
|
2
9
|
|
|
3
10
|
|
package/dist/module.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Connection } from 'amqplib';
|
|
1
|
+
import type { Channel, Connection } from 'amqplib';
|
|
2
2
|
import type { Config, ConfigInput } from './config';
|
|
3
3
|
import type { ConsumeHandlers } from './consume';
|
|
4
4
|
import type { PublishOptionsExtended } from './publish';
|
|
@@ -16,6 +16,7 @@ export declare class Client {
|
|
|
16
16
|
protected createConnection(): Promise<Connection>;
|
|
17
17
|
useConnection(): Promise<Connection>;
|
|
18
18
|
protected recreateConsumers(): Promise<void>;
|
|
19
|
+
protected createConsumer(options: ConsumeOptions, handlers: ConsumeHandlers): Promise<Channel>;
|
|
19
20
|
consume(options: ConsumeOptions, handlers: ConsumeHandlers): Promise<void>;
|
|
20
21
|
publish(options: PublishOptionsExtended): Promise<boolean>;
|
|
21
22
|
}
|
package/dist/module.js
CHANGED
|
@@ -64,10 +64,10 @@ class Client {
|
|
|
64
64
|
}
|
|
65
65
|
async recreateConsumers() {
|
|
66
66
|
for (let i = 0; i < this.consumers.length; i++) {
|
|
67
|
-
await this.
|
|
67
|
+
await this.createConsumer(this.consumers[i].options, this.consumers[i].handlers);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
async
|
|
70
|
+
async createConsumer(options, handlers) {
|
|
71
71
|
const connection = await this.useConnection();
|
|
72
72
|
const channel = await connection.createChannel();
|
|
73
73
|
options = (0, smob_1.merge)(options, this.config.consume);
|
|
@@ -120,6 +120,10 @@ class Client {
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
await channel.consume(queueName, (message) => handleMessage(message), (0, consume_1.buildDriverConsumeOptions)(options));
|
|
123
|
+
return channel;
|
|
124
|
+
}
|
|
125
|
+
async consume(options, handlers) {
|
|
126
|
+
await this.createConsumer(options, handlers);
|
|
123
127
|
this.consumers.push({
|
|
124
128
|
options,
|
|
125
129
|
handlers,
|
package/package.json
CHANGED