xcraft-core-busclient 5.1.1 → 5.1.3
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/.zou-flow +3 -0
- package/lib/resp.js +4 -9
- package/package.json +1 -1
package/.zou-flow
ADDED
package/lib/resp.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const watt = require('gigawatts');
|
|
4
4
|
|
|
5
|
-
const injectDataContext = (data, ctx) => {
|
|
6
|
-
for (const [k, v] of ctx) {
|
|
7
|
-
data[k] = v;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
5
|
class Events {
|
|
11
6
|
constructor(busClient, log, orcName, routing, msgContext) {
|
|
12
7
|
this._busClient = busClient;
|
|
@@ -60,7 +55,7 @@ class Events {
|
|
|
60
55
|
this._busClient.events.unsubscribe(this._fixTopic(topic));
|
|
61
56
|
}
|
|
62
57
|
|
|
63
|
-
send(topic, data, serialize, forwarding = null) {
|
|
58
|
+
send(topic, data, serialize, forwarding = null, context = null) {
|
|
64
59
|
if (!this._busClient) {
|
|
65
60
|
this._log.err('events.send not available');
|
|
66
61
|
return;
|
|
@@ -94,7 +89,7 @@ class Events {
|
|
|
94
89
|
data,
|
|
95
90
|
serialize,
|
|
96
91
|
routing,
|
|
97
|
-
this._msgContext
|
|
92
|
+
context || this._msgContext
|
|
98
93
|
);
|
|
99
94
|
}
|
|
100
95
|
}
|
|
@@ -242,10 +237,10 @@ class Resp {
|
|
|
242
237
|
};
|
|
243
238
|
}
|
|
244
239
|
|
|
245
|
-
onCommandsRegistry(callback) {
|
|
240
|
+
onCommandsRegistry(callback, data) {
|
|
246
241
|
const _callback = () => {
|
|
247
242
|
this._makeCmdNames();
|
|
248
|
-
callback();
|
|
243
|
+
callback(null, data);
|
|
249
244
|
};
|
|
250
245
|
this._busClient.on('commands.registry', _callback);
|
|
251
246
|
return () => this._busClient.removeListener('commands.registry', _callback);
|