geonix 1.22.5 → 1.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonix",
3
- "version": "1.22.5",
3
+ "version": "1.23.0",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "bin": {
package/src/Service.js CHANGED
@@ -226,8 +226,10 @@ export class Service {
226
226
  }
227
227
  }
228
228
 
229
- async #sub(subject, handler) {
230
- const subscription = await connection.subscribe(subject);
229
+ async #sub(_subject, handler) {
230
+ const [subject, queue] = _subject.split(",");
231
+
232
+ const subscription = await connection.subscribe(subject, { queue });
231
233
  const processor = async () => {
232
234
  for await (const event of subscription) {
233
235
  handler(event.data);
package/test/pubsub.js ADDED
@@ -0,0 +1,29 @@
1
+ import { Publish, Remote, Service } from "../exports.js";
2
+ import { sleep } from "../src/Util.js";
3
+
4
+ class TimeService extends Service {
5
+
6
+ counter = 0;
7
+
8
+ "SUB test,q1"(data) {
9
+ console.log(`SUB test (${this.counter++})`, data);
10
+ }
11
+
12
+ }
13
+
14
+ class ApplicationService extends Service {
15
+
16
+ async onStart() {
17
+ await sleep(1000);
18
+
19
+ while (true) {
20
+ await Publish("test", "Hello World");
21
+ await sleep(1000);
22
+ }
23
+ }
24
+
25
+ }
26
+
27
+ TimeService.start();
28
+ TimeService.start();
29
+ ApplicationService.start();