@rxdi/graphql-rabbitmq-subscriptions 0.7.134 → 0.7.137
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/amqp-pubsub.d.ts +2 -2
- package/dist/amqp-pubsub.js +5 -9
- package/package.json +2 -2
package/dist/amqp-pubsub.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IRabbitMqConnectionConfig, IQueueNameConfig } from
|
|
2
|
-
import { Logger } from
|
|
1
|
+
import { IRabbitMqConnectionConfig, IQueueNameConfig } from '@rxdi/rabbitmq-pubsub';
|
|
2
|
+
import { Logger } from './child-logger';
|
|
3
3
|
export interface PubSubRabbitMQBusOptions {
|
|
4
4
|
config?: IRabbitMqConnectionConfig;
|
|
5
5
|
connectionListener?: (err: Error) => void;
|
package/dist/amqp-pubsub.js
CHANGED
|
@@ -19,11 +19,10 @@ class AmqpPubSub {
|
|
|
19
19
|
this.subsRefsMap = {};
|
|
20
20
|
this.currentSubscriptionId = 0;
|
|
21
21
|
this.unsubscribeChannelMap = {};
|
|
22
|
-
this.triggerTransform =
|
|
23
|
-
|
|
24
|
-
const config = options.config || { host: "127.0.0.1", port: 5672 };
|
|
22
|
+
this.triggerTransform = options.triggerTransform || ((trigger) => trigger);
|
|
23
|
+
const config = options.config || { host: '127.0.0.1', port: 5672 };
|
|
25
24
|
const { logger } = options;
|
|
26
|
-
this.logger = (0, child_logger_1.createChildLogger)(logger,
|
|
25
|
+
this.logger = (0, child_logger_1.createChildLogger)(logger, 'AmqpPubSub');
|
|
27
26
|
const factory = new rabbitmq_pubsub_1.RabbitMqSingletonConnectionFactory(logger, config);
|
|
28
27
|
this.consumer = new rabbitmq_pubsub_1.RabbitMqSubscriber(logger, factory);
|
|
29
28
|
this.producer = new rabbitmq_pubsub_1.RabbitMqPublisher(logger, factory);
|
|
@@ -49,10 +48,7 @@ class AmqpPubSub {
|
|
|
49
48
|
this.logger.trace("trying to subscribe to queue '%s'", triggerName);
|
|
50
49
|
try {
|
|
51
50
|
const disposer = yield this.consumer.subscribe(triggerName, (msg) => this.onMessage(triggerName, msg), options);
|
|
52
|
-
this.subsRefsMap[triggerName] = [
|
|
53
|
-
...(this.subsRefsMap[triggerName] || []),
|
|
54
|
-
id,
|
|
55
|
-
];
|
|
51
|
+
this.subsRefsMap[triggerName] = [...(this.subsRefsMap[triggerName] || []), id];
|
|
56
52
|
this.unsubscribeChannelMap[id] = disposer;
|
|
57
53
|
return id;
|
|
58
54
|
}
|
|
@@ -67,7 +63,7 @@ class AmqpPubSub {
|
|
|
67
63
|
const refs = this.subsRefsMap[triggerName];
|
|
68
64
|
if (!refs) {
|
|
69
65
|
this.logger.error("There is no subscription of id '%s'", subId);
|
|
70
|
-
throw new Error(`There is no subscription of id "{subId}"`);
|
|
66
|
+
throw new Error(`There is no subscription of id "${subId}"`);
|
|
71
67
|
}
|
|
72
68
|
let newRefs;
|
|
73
69
|
if (refs.length === 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdi/graphql-rabbitmq-subscriptions",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.137",
|
|
4
4
|
"description": "A graphql-subscriptions PubSub Engine using RabbitMQ",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"graphql-subscriptions": "^1.1.0",
|
|
28
|
-
"@rxdi/rabbitmq-pubsub": "^0.7.
|
|
28
|
+
"@rxdi/rabbitmq-pubsub": "^0.7.136"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^12.0.10",
|