@signageos/lib 23.9.1 → 23.9.2
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/README.md +2 -2
- package/dist/AMQP/CQRS/ICommand.d.ts +3 -36
- package/dist/AMQP/CQRS/ICommand.js +18 -0
- package/dist/AMQP/CQRS/ICommand.js.map +1 -1
- package/dist/AMQP/CQRS/ICommandError.d.ts +4 -4
- package/dist/AMQP/CQRS/commandQueue.d.ts +4 -59
- package/dist/AMQP/CQRS/commandQueue.js +16 -308
- package/dist/AMQP/CQRS/commandQueue.js.map +1 -1
- package/dist/AMQP/CQRS/commandResponseHelper.d.ts +4 -3
- package/dist/AMQP/CQRS/commandResponseHelper.js +18 -5
- package/dist/AMQP/CQRS/commandResponseHelper.js.map +1 -1
- package/dist/AMQP/CQRS/storedCommandQueue.d.ts +4 -27
- package/dist/AMQP/CQRS/storedCommandQueue.js +16 -296
- package/dist/AMQP/CQRS/storedCommandQueue.js.map +1 -1
- package/dist/AMQP/ChannelProvider.d.ts +5 -37
- package/dist/AMQP/ChannelProvider.js +9 -868
- package/dist/AMQP/ChannelProvider.js.map +1 -1
- package/dist/AMQP/DeviceActions/Bridge/deviceActionBridgeFactory.d.ts +4 -39
- package/dist/AMQP/DeviceActions/Bridge/deviceActionBridgeFactory.js +16 -287
- package/dist/AMQP/DeviceActions/Bridge/deviceActionBridgeFactory.js.map +1 -1
- package/dist/AMQP/DeviceActions/IDeviceAction.d.ts +4 -4
- package/dist/AMQP/DeviceActions/deviceActionsQueue.d.ts +2 -81
- package/dist/AMQP/DeviceActions/deviceActionsQueue.js +14 -531
- package/dist/AMQP/DeviceActions/deviceActionsQueue.js.map +1 -1
- package/dist/AMQP/EventSourcing/EventConsumer/AmqpEventConsumer.d.ts +2 -45
- package/dist/AMQP/EventSourcing/EventConsumer/AmqpEventConsumer.js +14 -211
- package/dist/AMQP/EventSourcing/EventConsumer/AmqpEventConsumer.js.map +1 -1
- package/dist/AMQP/EventSourcing/EventConsumer/IEventConsumer.d.ts +2 -11
- package/dist/AMQP/EventSourcing/EventConsumer/IEventConsumer.js +18 -0
- package/dist/AMQP/EventSourcing/EventConsumer/IEventConsumer.js.map +1 -1
- package/dist/AMQP/EventSourcing/EventConsumer/InMemoryEventConsumer.d.ts +2 -13
- package/dist/AMQP/EventSourcing/EventConsumer/InMemoryEventConsumer.js +14 -69
- package/dist/AMQP/EventSourcing/EventConsumer/InMemoryEventConsumer.js.map +1 -1
- package/dist/AMQP/EventSourcing/IEvent.d.ts +3 -70
- package/dist/AMQP/EventSourcing/IEvent.js +18 -0
- package/dist/AMQP/EventSourcing/IEvent.js.map +1 -1
- package/dist/AMQP/EventSourcing/Locked/deferredState.d.ts +2 -19
- package/dist/AMQP/EventSourcing/Locked/deferredState.js +15 -66
- package/dist/AMQP/EventSourcing/Locked/deferredState.js.map +1 -1
- package/dist/AMQP/EventSourcing/Locked/lockedEventConsumer.d.ts +2 -68
- package/dist/AMQP/EventSourcing/Locked/lockedEventConsumer.js +14 -429
- package/dist/AMQP/EventSourcing/Locked/lockedEventConsumer.js.map +1 -1
- package/dist/AMQP/EventSourcing/Locked/rejectedTimestamps.d.ts +2 -22
- package/dist/AMQP/EventSourcing/Locked/rejectedTimestamps.js +16 -59
- package/dist/AMQP/EventSourcing/Locked/rejectedTimestamps.js.map +1 -1
- package/dist/AMQP/EventSourcing/Locked/withLock.d.ts +2 -40
- package/dist/AMQP/EventSourcing/Locked/withLock.js +14 -134
- package/dist/AMQP/EventSourcing/Locked/withLock.js.map +1 -1
- package/dist/AMQP/EventSourcing/eventQueue.d.ts +2 -85
- package/dist/AMQP/EventSourcing/eventQueue.js +14 -132
- package/dist/AMQP/EventSourcing/eventQueue.js.map +1 -1
- package/dist/AMQP/EventSourcing/eventQueue.utils.d.ts +2 -71
- package/dist/AMQP/EventSourcing/eventQueue.utils.js +16 -152
- package/dist/AMQP/EventSourcing/eventQueue.utils.js.map +1 -1
- package/dist/AMQP/EventSourcing/eventQueueDetached.d.ts +2 -47
- package/dist/AMQP/EventSourcing/eventQueueDetached.js +14 -421
- package/dist/AMQP/EventSourcing/eventQueueDetached.js.map +1 -1
- package/dist/AMQP/EventSourcing/eventQueueDomain.d.ts +2 -53
- package/dist/AMQP/EventSourcing/eventQueueDomain.js +14 -611
- package/dist/AMQP/EventSourcing/eventQueueDomain.js.map +1 -1
- package/dist/AMQP/EventSourcing/eventQueuePublish.d.ts +2 -17
- package/dist/AMQP/EventSourcing/eventQueuePublish.js +14 -202
- package/dist/AMQP/EventSourcing/eventQueuePublish.js.map +1 -1
- package/dist/AMQP/EventSourcing/synchronization.d.ts +2 -37
- package/dist/AMQP/EventSourcing/synchronization.js +18 -9
- package/dist/AMQP/EventSourcing/synchronization.js.map +1 -1
- package/dist/AMQP/Exchange.d.ts +4 -1
- package/dist/AMQP/Exchange.js +18 -0
- package/dist/AMQP/Exchange.js.map +1 -1
- package/dist/AMQP/IAsyncGotMessage.d.ts +2 -13
- package/dist/AMQP/IAsyncGotMessage.js +18 -0
- package/dist/AMQP/IAsyncGotMessage.js.map +1 -1
- package/dist/AMQP/IChannel.d.ts +5 -43
- package/dist/AMQP/IChannel.js +18 -0
- package/dist/AMQP/IChannel.js.map +1 -1
- package/dist/AMQP/IConsumeOptions.d.ts +5 -106
- package/dist/AMQP/IConsumeOptions.js +18 -0
- package/dist/AMQP/IConsumeOptions.js.map +1 -1
- package/dist/AMQP/IMessageOptions.d.ts +5 -6
- package/dist/AMQP/IMessageOptions.js +18 -0
- package/dist/AMQP/IMessageOptions.js.map +1 -1
- package/dist/AMQP/INackOptions.d.ts +5 -4
- package/dist/AMQP/INackOptions.js +18 -0
- package/dist/AMQP/INackOptions.js.map +1 -1
- package/dist/AMQP/IQueueOptions.d.ts +5 -8
- package/dist/AMQP/IQueueOptions.js +18 -0
- package/dist/AMQP/IQueueOptions.js.map +1 -1
- package/dist/AMQP/Logging/IDeviceLog.d.ts +4 -15
- package/dist/AMQP/Logging/IDeviceLog.js +18 -7
- package/dist/AMQP/Logging/IDeviceLog.js.map +1 -1
- package/dist/AMQP/Logging/logDeviceQueue.d.ts +4 -12
- package/dist/AMQP/Logging/logDeviceQueue.js +16 -102
- package/dist/AMQP/Logging/logDeviceQueue.js.map +1 -1
- package/dist/AMQP/QueueFetcher.d.ts +3 -11
- package/dist/AMQP/QueueFetcher.js +17 -156
- package/dist/AMQP/QueueFetcher.js.map +1 -1
- package/dist/AMQP/QueuePublisher.d.ts +5 -7
- package/dist/AMQP/QueuePublisher.js +19 -127
- package/dist/AMQP/QueuePublisher.js.map +1 -1
- package/dist/AMQP/QueueRepeatableSubscription.d.ts +5 -14
- package/dist/AMQP/QueueRepeatableSubscription.js +19 -154
- package/dist/AMQP/QueueRepeatableSubscription.js.map +1 -1
- package/dist/AMQP/QueueSubscriber.d.ts +5 -27
- package/dist/AMQP/QueueSubscriber.js +9 -303
- package/dist/AMQP/QueueSubscriber.js.map +1 -1
- package/dist/AMQP/ResponseProvider.d.ts +4 -20
- package/dist/AMQP/ResponseProvider.js +16 -188
- package/dist/AMQP/ResponseProvider.js.map +1 -1
- package/dist/AMQP/Static/filesQueue.d.ts +4 -12
- package/dist/AMQP/Static/filesQueue.js +6 -205
- package/dist/AMQP/Static/filesQueue.js.map +1 -1
- package/dist/AMQP/amqpConnectionFactory.d.ts +2 -25
- package/dist/AMQP/amqpConnectionFactory.js +4 -219
- package/dist/AMQP/amqpConnectionFactory.js.map +1 -1
- package/dist/AMQP/amqpErrors.d.ts +4 -5
- package/dist/AMQP/amqpErrors.js +18 -27
- package/dist/AMQP/amqpErrors.js.map +1 -1
- package/dist/AMQP/errors.d.ts +4 -3
- package/dist/AMQP/errors.js +18 -27
- package/dist/AMQP/errors.js.map +1 -1
- package/dist/AMQP/fetchNextMessage.d.ts +3 -12
- package/dist/AMQP/fetchNextMessage.js +20 -111
- package/dist/AMQP/fetchNextMessage.js.map +1 -1
- package/dist/AMQP/queueConfigurator.d.ts +2 -3
- package/dist/AMQP/queueConfigurator.js +14 -71
- package/dist/AMQP/queueConfigurator.js.map +1 -1
- package/dist/DateTime/waitUntil.d.ts +4 -15
- package/dist/DateTime/waitUntil.js +17 -139
- package/dist/DateTime/waitUntil.js.map +1 -1
- package/dist/Events/AsyncEventEmitter.d.ts +2 -29
- package/dist/Events/AsyncEventEmitter.js +14 -118
- package/dist/Events/AsyncEventEmitter.js.map +1 -1
- package/dist/Events/eventsHelpers.d.ts +4 -3
- package/dist/Events/eventsHelpers.js +18 -21
- package/dist/Events/eventsHelpers.js.map +1 -1
- package/dist/Hash/checksum.d.ts +2 -3
- package/dist/Hash/checksum.js +16 -15
- package/dist/Hash/checksum.js.map +1 -1
- package/dist/Hash/checksumFile.d.ts +2 -2
- package/dist/Hash/checksumFile.js +4 -65
- package/dist/Hash/checksumFile.js.map +1 -1
- package/dist/Hash/generator.d.ts +4 -2
- package/dist/Hash/generator.js +18 -12
- package/dist/Hash/generator.js.map +1 -1
- package/dist/HttpStatus/checks/amqpStatusCheck.d.ts +1 -1
- package/dist/HttpStatus/statuses/amqpStatus.d.ts +1 -1
- package/dist/Metrics/MetricsClient.d.ts +2 -44
- package/dist/Metrics/MetricsClient.js +6 -86
- package/dist/Metrics/MetricsClient.js.map +1 -1
- package/dist/Metrics/metrics.d.ts +2 -82
- package/dist/Metrics/metrics.js +4 -238
- package/dist/Metrics/metrics.js.map +1 -1
- package/dist/Metrics/processSocketsMetrics.d.ts +4 -10
- package/dist/Metrics/processSocketsMetrics.js +17 -88
- package/dist/Metrics/processSocketsMetrics.js.map +1 -1
- package/dist/Service/dbConnections.d.ts +1 -1
- package/dist/Service/metrics/connections.js +7 -7
- package/dist/Service/metrics/connections.js.map +1 -1
- package/dist/ThirdParty/connection.d.ts +0 -11
- package/package.json +5 -9
- package/dist/AMQP/IAMQPPool.d.ts +0 -5
- package/dist/AMQP/IAMQPPool.js +0 -3
- package/dist/AMQP/IAMQPPool.js.map +0 -1
- package/dist/Events/genericGracefulExit.d.ts +0 -11
- package/dist/Events/genericGracefulExit.js +0 -90
- package/dist/Events/genericGracefulExit.js.map +0 -1
- package/dist/GenericPool/options.d.ts +0 -63
- package/dist/GenericPool/options.js +0 -3
- package/dist/GenericPool/options.js.map +0 -1
- package/dist/Metrics/deviceConsumerMetrics.d.ts +0 -6
- package/dist/Metrics/deviceConsumerMetrics.js +0 -59
- package/dist/Metrics/deviceConsumerMetrics.js.map +0 -1
- package/dist/Metrics/eventConsumerMetrics.d.ts +0 -19
- package/dist/Metrics/eventConsumerMetrics.js +0 -52
- package/dist/Metrics/eventConsumerMetrics.js.map +0 -1
- package/dist/Metrics/eventQueueMetrics.d.ts +0 -7
- package/dist/Metrics/eventQueueMetrics.js +0 -19
- package/dist/Metrics/eventQueueMetrics.js.map +0 -1
- package/dist/Pool/IBasePool.d.ts +0 -6
- package/dist/Pool/IBasePool.js +0 -3
- package/dist/Pool/IBasePool.js.map +0 -1
- package/dist/System/signalSender.d.ts +0 -1
- package/dist/System/signalSender.js +0 -7
- package/dist/System/signalSender.js.map +0 -1
|
@@ -1,538 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
-
if (ar || !(i in from)) {
|
|
52
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
-
ar[i] = from[i];
|
|
54
|
-
}
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
55
7
|
}
|
|
56
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
57
15
|
};
|
|
58
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.sendToDevice = sendToDevice;
|
|
60
|
-
exports.sendFromDevice = sendFromDevice;
|
|
61
|
-
exports.bindToDevice = bindToDevice;
|
|
62
|
-
exports.bindSpecificFromDevice = bindSpecificFromDevice;
|
|
63
|
-
exports.bindUnspecificFromDevice = bindUnspecificFromDevice;
|
|
64
|
-
exports.bindFailed = bindFailed;
|
|
65
|
-
var errors_1 = require("../errors");
|
|
66
|
-
var deviceConsumerMetrics_1 = require("../../Metrics/deviceConsumerMetrics");
|
|
67
|
-
var EXCHANGE_ACTIONS_TO_DEVICE = 'actionsToDevice';
|
|
68
|
-
var EXCHANGE_ACTIONS_NOT_DELIVERED_TO_DEVICE = 'actionsNotDeliveredToDevice';
|
|
69
|
-
var EXCHANGE_ACTIONS_FROM_DEVICE = 'actionsFromDevice';
|
|
70
|
-
var ALTERNATE_EXCHANGE_ACTIONS_FROM_DEVICE = 'alternateActionsFromDevice';
|
|
71
|
-
var UNSPECIFIC_ACTIONS_FROM_DEVICE_QUEUE_NAME = 'unspecificActionsFromDevice';
|
|
72
|
-
var FAILED_ACTIONS_CONSUMER_QUEUE_NAME = 'actionsNotDeliveredToDevice';
|
|
73
|
-
var DEFAULT_QUEUE_OPTIONS = {
|
|
74
|
-
persistent: false, // default value for messages (all are not persistent)
|
|
75
|
-
confirmable: true, // all messages enqueue promise is resolved after confirmation on rabbitmq
|
|
76
|
-
prefetchCount: 500,
|
|
77
|
-
};
|
|
78
|
-
var TO_DEVICE_CONSUME_OPTIONS = {
|
|
79
|
-
// to device queue is exclusive
|
|
80
|
-
autoDelete: false,
|
|
81
|
-
// to device queue is not recovered on restart
|
|
82
|
-
durable: false,
|
|
83
|
-
// to device queue is exclusive
|
|
84
|
-
exclusive: true,
|
|
85
|
-
respond: true,
|
|
86
|
-
};
|
|
87
|
-
var FROM_DEVICE_CONSUME_OPTIONS = {
|
|
88
|
-
// queue from device and not delivered are persistent (not autoDelete)
|
|
89
|
-
// will be kept even if 0 consumers (could happen only during BC deploys)
|
|
90
|
-
autoDelete: false,
|
|
91
|
-
// queue is durable (will not be deleted on restart to keep messages to be processed later)
|
|
92
|
-
durable: true,
|
|
93
|
-
queueType: 'quorum',
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* @param postponable Postponable actions has to be delivered. When device is not connected at the time, it's postponed for later.
|
|
97
|
-
* @param sessionUid Select a specific session (socket) to send message to. If specified, no other socket of single device get the action.
|
|
98
|
-
* @param sendTimeout Specify how long it will wait for response until action is enqueued as not delivered action.
|
|
99
|
-
*/
|
|
100
|
-
function sendToDevice(_a) {
|
|
101
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
102
|
-
var headers, exchange, routingKey, enqueueArgs, expectingResponse, startTime, duration, error_1;
|
|
103
|
-
var _c, _d;
|
|
104
|
-
var amqpConnection = _b.amqpConnection, action = _b.action, deviceUid = _b.deviceUid, _e = _b.postponable, postponable = _e === void 0 ? false : _e, sessionUid = _b.sessionUid, sendTimeout = _b.sendTimeout, sendToQueue = _b.sendToQueue;
|
|
105
|
-
return __generator(this, function (_f) {
|
|
106
|
-
switch (_f.label) {
|
|
107
|
-
case 0:
|
|
108
|
-
headers = {
|
|
109
|
-
deviceUid: deviceUid,
|
|
110
|
-
sessionUid: sessionUid,
|
|
111
|
-
actionType: action.type,
|
|
112
|
-
postponable: postponable,
|
|
113
|
-
};
|
|
114
|
-
if (sendToQueue) {
|
|
115
|
-
exchange = ''; // Default exchange, send straight to queue defined by routingKey
|
|
116
|
-
routingKey = sendToQueue;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
exchange = EXCHANGE_ACTIONS_TO_DEVICE;
|
|
120
|
-
routingKey = action.type; // routing using action type to omit not listened actions
|
|
121
|
-
}
|
|
122
|
-
_f.label = 1;
|
|
123
|
-
case 1:
|
|
124
|
-
_f.trys.push([1, 6, , 10]);
|
|
125
|
-
enqueueArgs = [
|
|
126
|
-
createChannelToDevice(amqpConnection, undefined),
|
|
127
|
-
action,
|
|
128
|
-
headers,
|
|
129
|
-
exchange,
|
|
130
|
-
routingKey,
|
|
131
|
-
{
|
|
132
|
-
// delivery to device is not persistent message
|
|
133
|
-
persistent: false,
|
|
134
|
-
// expire messages after some time to prevent queue growing large in case of consumer failure
|
|
135
|
-
expiration: sendTimeout * 2,
|
|
136
|
-
},
|
|
137
|
-
];
|
|
138
|
-
expectingResponse = !Boolean(sessionUid);
|
|
139
|
-
if (!expectingResponse) return [3 /*break*/, 3];
|
|
140
|
-
startTime = Date.now();
|
|
141
|
-
return [4 /*yield*/, (_c = amqpConnection.queuePublisher).enqueueExpectingResponse.apply(_c, __spreadArray(__spreadArray([], enqueueArgs, false), [sendTimeout], false))];
|
|
142
|
-
case 2:
|
|
143
|
-
_f.sent();
|
|
144
|
-
duration = (Date.now() - startTime) / 1000;
|
|
145
|
-
deviceConsumerMetrics_1.metrics.emit('outgoing_actions_successful', { actionType: action.type });
|
|
146
|
-
deviceConsumerMetrics_1.metrics.emit('outgoing_actions_ack_duration', { actionType: action.type }, duration);
|
|
147
|
-
return [3 /*break*/, 5];
|
|
148
|
-
case 3: return [4 /*yield*/, (_d = amqpConnection.queuePublisher).enqueue.apply(_d, enqueueArgs)];
|
|
149
|
-
case 4:
|
|
150
|
-
_f.sent();
|
|
151
|
-
deviceConsumerMetrics_1.metrics.emit('outgoing_actions_successful', { actionType: action.type });
|
|
152
|
-
_f.label = 5;
|
|
153
|
-
case 5: return [3 /*break*/, 10];
|
|
154
|
-
case 6:
|
|
155
|
-
error_1 = _f.sent();
|
|
156
|
-
deviceConsumerMetrics_1.metrics.emit('outgoing_actions_erred', { actionType: action.type });
|
|
157
|
-
if (!(error_1 instanceof errors_1.ResponseTimeoutError)) return [3 /*break*/, 8];
|
|
158
|
-
return [4 /*yield*/, enqueueFailedAction(amqpConnection, action, deviceUid, postponable, sessionUid)];
|
|
159
|
-
case 7:
|
|
160
|
-
_f.sent();
|
|
161
|
-
return [3 /*break*/, 9];
|
|
162
|
-
case 8: throw error_1;
|
|
163
|
-
case 9: return [3 /*break*/, 10];
|
|
164
|
-
case 10: return [2 /*return*/];
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
function enqueueFailedAction(amqpConnection, action, deviceUid, postponable, sessionUid) {
|
|
170
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
var headers;
|
|
172
|
-
return __generator(this, function (_a) {
|
|
173
|
-
switch (_a.label) {
|
|
174
|
-
case 0:
|
|
175
|
-
headers = {
|
|
176
|
-
deviceUid: deviceUid,
|
|
177
|
-
sessionUid: sessionUid,
|
|
178
|
-
actionType: action.type,
|
|
179
|
-
postponable: postponable,
|
|
180
|
-
};
|
|
181
|
-
return [4 /*yield*/, amqpConnection.queuePublisher.enqueue(createChannelToDevice(amqpConnection, undefined), action, headers, EXCHANGE_ACTIONS_NOT_DELIVERED_TO_DEVICE, '', // fanout
|
|
182
|
-
{ persistent: true })];
|
|
183
|
-
case 1:
|
|
184
|
-
_a.sent();
|
|
185
|
-
return [2 /*return*/];
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* @param timestamp of action when it was sent from the device
|
|
192
|
-
*/
|
|
193
|
-
function sendFromDevice(_a) {
|
|
194
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
195
|
-
var headers;
|
|
196
|
-
var amqpConnection = _b.amqpConnection, action = _b.action, deviceUid = _b.deviceUid, sessionUid = _b.sessionUid, socketName = _b.socketName, consumerName = _b.consumerName, processUid = _b.processUid, timestamp = _b.timestamp, _c = _b.persistent, persistent = _c === void 0 ? true : _c;
|
|
197
|
-
return __generator(this, function (_d) {
|
|
198
|
-
switch (_d.label) {
|
|
199
|
-
case 0:
|
|
200
|
-
headers = {
|
|
201
|
-
deviceUid: deviceUid,
|
|
202
|
-
sessionUid: sessionUid,
|
|
203
|
-
socketName: socketName,
|
|
204
|
-
timestamp: timestamp,
|
|
205
|
-
responseQueueName: getActionsToDeviceQueueName(consumerName, processUid),
|
|
206
|
-
};
|
|
207
|
-
return [4 /*yield*/, amqpConnection.queuePublisher.enqueue(createChannelFromDevice(amqpConnection), action, headers, EXCHANGE_ACTIONS_FROM_DEVICE, // all actions are going through one queue from device
|
|
208
|
-
action.type, // routingKey=actionType, messages are routed to specific queue or to unspecific if nothing bound
|
|
209
|
-
{ persistent: persistent })];
|
|
210
|
-
case 1:
|
|
211
|
-
_d.sent();
|
|
212
|
-
return [2 /*return*/];
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
function trackActionMetrics(action, callback) {
|
|
218
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
-
var startTime, result, error_2, duration;
|
|
220
|
-
return __generator(this, function (_a) {
|
|
221
|
-
switch (_a.label) {
|
|
222
|
-
case 0:
|
|
223
|
-
deviceConsumerMetrics_1.metrics.emit('incoming_actions_received', { actionType: action.type });
|
|
224
|
-
startTime = Date.now();
|
|
225
|
-
_a.label = 1;
|
|
226
|
-
case 1:
|
|
227
|
-
_a.trys.push([1, 3, 4, 5]);
|
|
228
|
-
return [4 /*yield*/, callback()];
|
|
229
|
-
case 2:
|
|
230
|
-
result = _a.sent();
|
|
231
|
-
deviceConsumerMetrics_1.metrics.emit('incoming_actions_successful', { actionType: action.type });
|
|
232
|
-
return [2 /*return*/, result];
|
|
233
|
-
case 3:
|
|
234
|
-
error_2 = _a.sent();
|
|
235
|
-
deviceConsumerMetrics_1.metrics.emit('incoming_actions_erred', { actionType: action.type });
|
|
236
|
-
throw error_2;
|
|
237
|
-
case 4:
|
|
238
|
-
duration = (Date.now() - startTime) / 1000;
|
|
239
|
-
deviceConsumerMetrics_1.metrics.emit('incoming_actions_processing_duration', { actionType: action.type }, duration);
|
|
240
|
-
return [7 /*endfinally*/];
|
|
241
|
-
case 5: return [2 /*return*/];
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
function bindToDevice(amqpConnection, consumerName, processUid, onAction) {
|
|
247
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
248
|
-
var onRelatedAction, cancelConsumption;
|
|
249
|
-
var _this = this;
|
|
250
|
-
return __generator(this, function (_a) {
|
|
251
|
-
switch (_a.label) {
|
|
252
|
-
case 0:
|
|
253
|
-
onRelatedAction = function (action, headers, ack, nack) { return __awaiter(_this, void 0, void 0, function () {
|
|
254
|
-
return __generator(this, function (_a) {
|
|
255
|
-
switch (_a.label) {
|
|
256
|
-
case 0: return [4 /*yield*/, trackActionMetrics(action, function () { return onAction(headers.deviceUid, headers.sessionUid, action, ack, nack); })];
|
|
257
|
-
case 1:
|
|
258
|
-
_a.sent();
|
|
259
|
-
return [2 /*return*/];
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}); };
|
|
263
|
-
return [4 /*yield*/, amqpConnection.queueSubscriber.subscribeExpectingConfirmationRepeatable(createChannelToDevice(amqpConnection, processUid), getActionsToDeviceQueueName(consumerName, processUid), [{ exchangeName: EXCHANGE_ACTIONS_TO_DEVICE, persistent: false }], onRelatedAction, TO_DEVICE_CONSUME_OPTIONS)];
|
|
264
|
-
case 1:
|
|
265
|
-
cancelConsumption = _a.sent();
|
|
266
|
-
return [2 /*return*/, cancelConsumption];
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Binds action messages by a specific actionTypes to a single queue. The queue is named after the input group.
|
|
273
|
-
* So, more action types are grouped together into single queue. This is preventing from stucking messages across more
|
|
274
|
-
* priority leveled groups.
|
|
275
|
-
* E.g.: The priority actions used for authentication, registration & verification should not be affected by telemetry actions in any way.
|
|
276
|
-
* The priority actions has much more strict requirements on SLA.
|
|
277
|
-
*
|
|
278
|
-
* @param consumerType the string name of consumer type which will be used as a part of queue name. For backward compatibility it can be undefined and the queue name will not contain it.
|
|
279
|
-
* @param group the string name of group which will be used as a part of queue name.
|
|
280
|
-
* @param actionTypes all types of actions which are bound to the queue.
|
|
281
|
-
* @param onAction the callback which is called for every action bound above.
|
|
282
|
-
*/
|
|
283
|
-
function bindSpecificFromDevice(amqpConnection, consumerType, group, actionTypes, onAction, options) {
|
|
284
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
285
|
-
var fullOptions, onRelatedAction;
|
|
286
|
-
var _this = this;
|
|
287
|
-
return __generator(this, function (_a) {
|
|
288
|
-
switch (_a.label) {
|
|
289
|
-
case 0:
|
|
290
|
-
fullOptions = __assign(__assign({}, FROM_DEVICE_CONSUME_OPTIONS), options);
|
|
291
|
-
onRelatedAction = function (action, headers) { return __awaiter(_this, void 0, void 0, function () {
|
|
292
|
-
return __generator(this, function (_a) {
|
|
293
|
-
switch (_a.label) {
|
|
294
|
-
case 0: return [4 /*yield*/, trackActionMetrics(action, function () {
|
|
295
|
-
return onAction({
|
|
296
|
-
action: action,
|
|
297
|
-
deviceUid: headers.deviceUid,
|
|
298
|
-
sessionUid: headers.sessionUid,
|
|
299
|
-
socketName: headers.socketName,
|
|
300
|
-
timestamp: headers.timestamp,
|
|
301
|
-
responseQueueName: headers.responseQueueName,
|
|
302
|
-
});
|
|
303
|
-
})];
|
|
304
|
-
case 1:
|
|
305
|
-
_a.sent();
|
|
306
|
-
return [2 /*return*/];
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
}); };
|
|
310
|
-
return [4 /*yield*/, amqpConnection.queueSubscriber.subscribeRepeatable(createChannelSpecificFromDevice(amqpConnection, group), getSpecificActionsFromDeviceQueueName(consumerType, group), actionTypes.map(function (actionType) { return ({ exchangeName: EXCHANGE_ACTIONS_FROM_DEVICE, persistent: true, routingKey: actionType }); }), onRelatedAction, fullOptions)];
|
|
311
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
17
|
/**
|
|
317
|
-
*
|
|
318
|
-
* Those unspecific actions has self alternate exchange and appropriate single queue.
|
|
319
|
-
* This consumption can be used for all not specifically bound actions, for example action logs of devices.
|
|
320
|
-
*
|
|
321
|
-
* @param onAction the callback which is called for every action ever not specifically bound by bindSpecificFromDevice.
|
|
18
|
+
* @deprecated Use `@signageos/amqp` instead.
|
|
322
19
|
*/
|
|
323
|
-
|
|
324
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
325
|
-
var fullOptions, onRelatedAction;
|
|
326
|
-
var _this = this;
|
|
327
|
-
return __generator(this, function (_a) {
|
|
328
|
-
switch (_a.label) {
|
|
329
|
-
case 0:
|
|
330
|
-
fullOptions = __assign(__assign({}, FROM_DEVICE_CONSUME_OPTIONS), options);
|
|
331
|
-
onRelatedAction = function (action, headers) { return __awaiter(_this, void 0, void 0, function () {
|
|
332
|
-
return __generator(this, function (_a) {
|
|
333
|
-
switch (_a.label) {
|
|
334
|
-
case 0: return [4 /*yield*/, trackActionMetrics(action, function () {
|
|
335
|
-
return onAction({
|
|
336
|
-
action: action,
|
|
337
|
-
deviceUid: headers.deviceUid,
|
|
338
|
-
sessionUid: headers.sessionUid,
|
|
339
|
-
socketName: headers.socketName,
|
|
340
|
-
timestamp: headers.timestamp,
|
|
341
|
-
responseQueueName: headers.responseQueueName,
|
|
342
|
-
});
|
|
343
|
-
})];
|
|
344
|
-
case 1:
|
|
345
|
-
_a.sent();
|
|
346
|
-
return [2 /*return*/];
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
}); };
|
|
350
|
-
return [4 /*yield*/, amqpConnection.queueSubscriber.subscribeRepeatable(createChannelUnspecificFromDevice(amqpConnection), getUnspecificActionsFromDeviceQueueName(consumerType), [{ exchangeName: ALTERNATE_EXCHANGE_ACTIONS_FROM_DEVICE, persistent: true }], onRelatedAction, fullOptions)];
|
|
351
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
function bindFailed(amqpConnection, onAction, options) {
|
|
357
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
358
|
-
var fullOptions, onActionCallback;
|
|
359
|
-
var _this = this;
|
|
360
|
-
return __generator(this, function (_a) {
|
|
361
|
-
switch (_a.label) {
|
|
362
|
-
case 0:
|
|
363
|
-
fullOptions = __assign(__assign({}, FROM_DEVICE_CONSUME_OPTIONS), options);
|
|
364
|
-
onActionCallback = function (action, headers, ack, nack) { return __awaiter(_this, void 0, void 0, function () {
|
|
365
|
-
return __generator(this, function (_a) {
|
|
366
|
-
switch (_a.label) {
|
|
367
|
-
case 0: return [4 /*yield*/, trackActionMetrics(action, function () { return onAction(action, headers.deviceUid, headers.postponable, ack, nack); })];
|
|
368
|
-
case 1:
|
|
369
|
-
_a.sent();
|
|
370
|
-
return [2 /*return*/];
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
}); };
|
|
374
|
-
return [4 /*yield*/, amqpConnection.queueSubscriber.subscribeExpectingConfirmationRepeatable(createChannelFailedToDevice(amqpConnection), FAILED_ACTIONS_CONSUMER_QUEUE_NAME, // failed messages are flat in one queue
|
|
375
|
-
[
|
|
376
|
-
// bind all not delivered actions (dead-lettered during delivering to device)
|
|
377
|
-
{ exchangeName: EXCHANGE_ACTIONS_NOT_DELIVERED_TO_DEVICE, persistent: true },
|
|
378
|
-
], onActionCallback, fullOptions)];
|
|
379
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
function createChannelFailedToDevice(amqpConnection, options) {
|
|
385
|
-
var _this = this;
|
|
386
|
-
var FAILED_ACTIONS_CHANNEL_NAME = 'actionsNotDeliveredToDevice';
|
|
387
|
-
var fullOptions = __assign(__assign({}, DEFAULT_QUEUE_OPTIONS), options);
|
|
388
|
-
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
389
|
-
var channel;
|
|
390
|
-
return __generator(this, function (_a) {
|
|
391
|
-
switch (_a.label) {
|
|
392
|
-
case 0: return [4 /*yield*/, amqpConnection.channelProvider.getChannel(FAILED_ACTIONS_CHANNEL_NAME, fullOptions)];
|
|
393
|
-
case 1:
|
|
394
|
-
channel = _a.sent();
|
|
395
|
-
return [4 /*yield*/, assertExchangeActionsNotDeliveredToDevice(channel)];
|
|
396
|
-
case 2:
|
|
397
|
-
_a.sent();
|
|
398
|
-
return [2 /*return*/, channel];
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
}); };
|
|
402
|
-
}
|
|
403
|
-
function createChannelFromDevice(amqpConnection, options) {
|
|
404
|
-
var _this = this;
|
|
405
|
-
var FROM_DEVICE_CHANNEL_NAME = 'actionsFromDevice';
|
|
406
|
-
var fullOptions = __assign(__assign({}, DEFAULT_QUEUE_OPTIONS), options);
|
|
407
|
-
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
408
|
-
var channel;
|
|
409
|
-
return __generator(this, function (_a) {
|
|
410
|
-
switch (_a.label) {
|
|
411
|
-
case 0: return [4 /*yield*/, amqpConnection.channelProvider.getChannel(FROM_DEVICE_CHANNEL_NAME, fullOptions)];
|
|
412
|
-
case 1:
|
|
413
|
-
channel = _a.sent();
|
|
414
|
-
return [4 /*yield*/, assertExchangeActionsFromDevice(channel)];
|
|
415
|
-
case 2:
|
|
416
|
-
_a.sent();
|
|
417
|
-
return [2 /*return*/, channel];
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
}); };
|
|
421
|
-
}
|
|
422
|
-
function createChannelSpecificFromDevice(amqpConnection, group, options) {
|
|
423
|
-
var _this = this;
|
|
424
|
-
var fromDeviceChannelName = "specificActionsFromDevice.".concat(group);
|
|
425
|
-
var fullOptions = __assign(__assign({}, DEFAULT_QUEUE_OPTIONS), options);
|
|
426
|
-
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
427
|
-
var channel;
|
|
428
|
-
return __generator(this, function (_a) {
|
|
429
|
-
switch (_a.label) {
|
|
430
|
-
case 0: return [4 /*yield*/, amqpConnection.channelProvider.getChannel(fromDeviceChannelName, fullOptions)];
|
|
431
|
-
case 1:
|
|
432
|
-
channel = _a.sent();
|
|
433
|
-
return [4 /*yield*/, assertExchangeActionsFromDevice(channel)];
|
|
434
|
-
case 2:
|
|
435
|
-
_a.sent();
|
|
436
|
-
return [2 /*return*/, channel];
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
}); };
|
|
440
|
-
}
|
|
441
|
-
function createChannelUnspecificFromDevice(amqpConnection, options) {
|
|
442
|
-
var _this = this;
|
|
443
|
-
var FROM_DEVICE_CHANNEL_NAME = 'unspecificActionsFromDevice';
|
|
444
|
-
var fullOptions = __assign(__assign({}, DEFAULT_QUEUE_OPTIONS), options);
|
|
445
|
-
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
446
|
-
var channel;
|
|
447
|
-
return __generator(this, function (_a) {
|
|
448
|
-
switch (_a.label) {
|
|
449
|
-
case 0: return [4 /*yield*/, amqpConnection.channelProvider.getChannel(FROM_DEVICE_CHANNEL_NAME, fullOptions)];
|
|
450
|
-
case 1:
|
|
451
|
-
channel = _a.sent();
|
|
452
|
-
return [4 /*yield*/, assertAlternateExchangeActionsFromDevice(channel)];
|
|
453
|
-
case 2:
|
|
454
|
-
_a.sent();
|
|
455
|
-
return [2 /*return*/, channel];
|
|
456
|
-
}
|
|
457
|
-
});
|
|
458
|
-
}); };
|
|
459
|
-
}
|
|
460
|
-
function createChannelToDevice(amqpConnection, processUid, options) {
|
|
461
|
-
var _this = this;
|
|
462
|
-
var TO_DEVICE_CHANNEL_NAME = 'actionsToDevice' + (typeof processUid === 'undefined' ? '' : '.' + processUid);
|
|
463
|
-
var fullOptions = __assign(__assign({}, DEFAULT_QUEUE_OPTIONS), options);
|
|
464
|
-
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
465
|
-
var channel;
|
|
466
|
-
return __generator(this, function (_a) {
|
|
467
|
-
switch (_a.label) {
|
|
468
|
-
case 0: return [4 /*yield*/, amqpConnection.channelProvider.getChannel(TO_DEVICE_CHANNEL_NAME, fullOptions)];
|
|
469
|
-
case 1:
|
|
470
|
-
channel = _a.sent();
|
|
471
|
-
return [4 /*yield*/, assertExchangeActionsToDevice(channel)];
|
|
472
|
-
case 2:
|
|
473
|
-
_a.sent();
|
|
474
|
-
return [2 /*return*/, channel];
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
}); };
|
|
478
|
-
}
|
|
479
|
-
function assertExchangeActionsToDevice(channel) {
|
|
480
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
481
|
-
return __generator(this, function (_a) {
|
|
482
|
-
switch (_a.label) {
|
|
483
|
-
case 0: return [4 /*yield*/, channel.assertExchange(EXCHANGE_ACTIONS_TO_DEVICE, 'fanout')];
|
|
484
|
-
case 1:
|
|
485
|
-
_a.sent();
|
|
486
|
-
return [2 /*return*/];
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
function assertExchangeActionsNotDeliveredToDevice(channel) {
|
|
492
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
493
|
-
return __generator(this, function (_a) {
|
|
494
|
-
switch (_a.label) {
|
|
495
|
-
case 0: return [4 /*yield*/, channel.assertExchange(EXCHANGE_ACTIONS_NOT_DELIVERED_TO_DEVICE, 'fanout')];
|
|
496
|
-
case 1:
|
|
497
|
-
_a.sent();
|
|
498
|
-
return [2 /*return*/];
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
function assertExchangeActionsFromDevice(channel) {
|
|
504
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
505
|
-
return __generator(this, function (_a) {
|
|
506
|
-
switch (_a.label) {
|
|
507
|
-
case 0: return [4 /*yield*/, channel.assertExchange(EXCHANGE_ACTIONS_FROM_DEVICE, 'direct', {
|
|
508
|
-
alternateExchange: ALTERNATE_EXCHANGE_ACTIONS_FROM_DEVICE,
|
|
509
|
-
})];
|
|
510
|
-
case 1:
|
|
511
|
-
_a.sent();
|
|
512
|
-
return [2 /*return*/];
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
function assertAlternateExchangeActionsFromDevice(channel) {
|
|
518
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
519
|
-
return __generator(this, function (_a) {
|
|
520
|
-
switch (_a.label) {
|
|
521
|
-
case 0: return [4 /*yield*/, channel.assertExchange(ALTERNATE_EXCHANGE_ACTIONS_FROM_DEVICE, 'fanout')];
|
|
522
|
-
case 1:
|
|
523
|
-
_a.sent();
|
|
524
|
-
return [2 /*return*/];
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
function getActionsToDeviceQueueName(consumerName, processUid) {
|
|
530
|
-
return 'actionsToDevice.' + consumerName + '.' + processUid;
|
|
531
|
-
}
|
|
532
|
-
function getSpecificActionsFromDeviceQueueName(consumerType, group) {
|
|
533
|
-
return (consumerType ? consumerType + '.' : '') + 'specificActionsFromDevice.' + group;
|
|
534
|
-
}
|
|
535
|
-
function getUnspecificActionsFromDeviceQueueName(consumerType) {
|
|
536
|
-
return (consumerType ? consumerType + '.' : '') + UNSPECIFIC_ACTIONS_FROM_DEVICE_QUEUE_NAME;
|
|
537
|
-
}
|
|
20
|
+
__exportStar(require("@signageos/amqp/dist/DeviceActions/deviceActionsQueue"), exports);
|
|
538
21
|
//# sourceMappingURL=deviceActionsQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceActionsQueue.js","sourceRoot":"","sources":["../../../src/AMQP/DeviceActions/deviceActionsQueue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deviceActionsQueue.js","sourceRoot":"","sources":["../../../src/AMQP/DeviceActions/deviceActionsQueue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,wFAAsE"}
|
|
@@ -1,47 +1,4 @@
|
|
|
1
|
-
import { IAMQPConnection } from '../../amqpConnectionFactory';
|
|
2
|
-
import { IEventPayload } from '../IEvent';
|
|
3
|
-
import { IBindOptions } from '../eventQueue.utils';
|
|
4
|
-
import { EventCallback, EventOptions, IEventConsumer } from './IEventConsumer';
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* This implementation uses AMQP queues to consume events.
|
|
9
|
-
*
|
|
10
|
-
* It abstracts all the implementation details of setting up consumption of events
|
|
11
|
-
* and provides a simple interface so that the consumer can focus on just handling the events.
|
|
12
|
-
*
|
|
13
|
-
* All events are consumed from a single queue in a sequential order.
|
|
14
|
-
* The name of the queue will be constructed from the consumer name and the domain as "<consumerName>_<domain>".
|
|
2
|
+
* @deprecated Use `@signageos/amqp` instead.
|
|
15
3
|
*/
|
|
16
|
-
export
|
|
17
|
-
private amqpConnection;
|
|
18
|
-
private consumerName;
|
|
19
|
-
private domain;
|
|
20
|
-
private options?;
|
|
21
|
-
private consumerCallbacks;
|
|
22
|
-
private stopCallback;
|
|
23
|
-
private started;
|
|
24
|
-
/**
|
|
25
|
-
* @param amqpConnection The AMQP connection to use
|
|
26
|
-
* @param consumerName The name of the consumer. This is used to identify the consumer in the AMQP queue
|
|
27
|
-
* @param domain The domain to consume events from. Defaults to 'default'
|
|
28
|
-
* @param options Additional options for the consumer
|
|
29
|
-
*/
|
|
30
|
-
constructor({ amqpConnection, consumerName, domain, options, }: {
|
|
31
|
-
amqpConnection: IAMQPConnection;
|
|
32
|
-
consumerName: string;
|
|
33
|
-
domain?: string;
|
|
34
|
-
options?: IBindOptions;
|
|
35
|
-
});
|
|
36
|
-
/**
|
|
37
|
-
* Add a consumer for a specific event type
|
|
38
|
-
*
|
|
39
|
-
* Has to be called before calling listen(), otherwise it will throw an error.
|
|
40
|
-
*/
|
|
41
|
-
addEventConsumer<TPayload extends IEventPayload>(eventType: string, callback: EventCallback<TPayload>, option?: EventOptions): void;
|
|
42
|
-
listen(): Promise<void>;
|
|
43
|
-
close(): Promise<void>;
|
|
44
|
-
private bindEvents;
|
|
45
|
-
private shouldConsumeEvent;
|
|
46
|
-
private consumeEvent;
|
|
47
|
-
}
|
|
4
|
+
export * from '@signageos/amqp/dist/EventSourcing/EventConsumer/AmqpEventConsumer';
|