amqp-extension 3.1.1 → 3.2.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [3.2.0](https://github.com/Tada5hi/amqp-extension/compare/v3.1.1...v3.2.0) (2024-03-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove unnecessary alias option ([8027d0a](https://github.com/Tada5hi/amqp-extension/commit/8027d0afb2063e5d0387dacf26cd77444dc933e4))
7
+
8
+
9
+ ### Features
10
+
11
+ * allways close channel after publishing ([a9b300f](https://github.com/Tada5hi/amqp-extension/commit/a9b300f6ab64d176a656cf9fc485f31a36168a7f))
12
+
1
13
  ## [3.1.1](https://github.com/Tada5hi/amqp-extension/compare/v3.1.0...v3.1.1) (2024-03-07)
2
14
 
3
15
 
@@ -4,7 +4,6 @@ exports.buildDriverConsumeOptions = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  function buildDriverConsumeOptions(options) {
6
6
  return (0, utils_1.removeKeysFromOptions)({ ...options }, [
7
- 'alias',
8
7
  'exchange',
9
8
  'queueName',
10
9
  'requeueOnFailure',
package/dist/module.js CHANGED
@@ -157,10 +157,12 @@ class Client {
157
157
  if (typeof exchangeOptions.routingKey === 'undefined') {
158
158
  throw new Error('The routingKey can not be empty if a non default exchange is selected.');
159
159
  }
160
- return channel.publish(this.config.exchange.name, exchangeOptions.routingKey, buffer, (0, publish_1.buildDriverPublishOptions)({
160
+ const published = channel.publish(this.config.exchange.name, exchangeOptions.routingKey, buffer, (0, publish_1.buildDriverPublishOptions)({
161
161
  persistent: true,
162
162
  ...options,
163
163
  }));
164
+ await channel.close();
165
+ return published;
164
166
  }
165
167
  // publish to default exchange
166
168
  const queueName = options.queueName ||
@@ -171,10 +173,12 @@ class Client {
171
173
  await channel.assertQueue(queueName, {
172
174
  durable: true,
173
175
  });
174
- return channel.sendToQueue(queueName, buffer, (0, publish_1.buildDriverPublishOptions)({
176
+ const published = channel.sendToQueue(queueName, buffer, (0, publish_1.buildDriverPublishOptions)({
175
177
  persistent: true,
176
178
  ...options,
177
179
  }));
180
+ await channel.close();
181
+ return published;
178
182
  }
179
183
  }
180
184
  exports.Client = Client;
@@ -4,7 +4,6 @@ exports.buildDriverPublishOptions = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  function buildDriverPublishOptions(options) {
6
6
  return (0, utils_1.removeKeysFromOptions)({ ...options }, [
7
- 'alias',
8
7
  'exchange',
9
8
  'queueName',
10
9
  'content',
package/dist/type.d.ts CHANGED
@@ -1,11 +1,6 @@
1
1
  import type { Options } from 'amqplib';
2
- import type { ConfigInput } from './config';
3
2
  import type { ExchangeOptions } from './exchange';
4
3
  type CommonOptions = {
5
- /**
6
- * Config key or object.
7
- */
8
- alias?: string | ConfigInput;
9
4
  /**
10
5
  * Exchange
11
6
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amqp-extension",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "An amqp extension with functions and utility functions to consume and publish queue messages.",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "dist/index.d.ts",