service-bridge 1.8.2-dev.38 → 1.8.2-dev.39
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 +3 -5
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -277,13 +277,12 @@ across all three SDKs. Parity differences are naming-only (language idioms):
|
|
|
277
277
|
function servicebridge(
|
|
278
278
|
url: string,
|
|
279
279
|
serviceKey: string,
|
|
280
|
-
|
|
281
|
-
maybeGlobalOpts?: ServiceBridgeOpts,
|
|
280
|
+
opts?: ServiceBridgeOpts,
|
|
282
281
|
): ServiceBridgeService
|
|
283
282
|
```
|
|
284
283
|
|
|
285
284
|
Creates an SDK client instance.
|
|
286
|
-
Service identity is resolved by the runtime from `serviceKey
|
|
285
|
+
Service identity is resolved by the runtime from `serviceKey`.
|
|
287
286
|
|
|
288
287
|
`ServiceBridgeOpts`:
|
|
289
288
|
|
|
@@ -575,13 +574,12 @@ Registers an event consumer handler. Chainable.
|
|
|
575
574
|
|
|
576
575
|
| Option | Type | Description |
|
|
577
576
|
|---|---|---|
|
|
578
|
-
| `groupName` | `string` | Consumer group name. Default: `<service-key-id>.<pattern>`. |
|
|
579
577
|
| `concurrency` | `number` | Advisory concurrency hint (currently not hard-enforced). |
|
|
580
578
|
| `prefetch` | `number` | Advisory prefetch hint (currently not hard-enforced). |
|
|
581
579
|
| `retryPolicyJson` | `string` | Retry policy JSON string. |
|
|
582
580
|
| `filterExpr` | `string` | Server-side filter expression. |
|
|
583
581
|
|
|
584
|
-
Duplicate
|
|
582
|
+
Duplicate pattern registration within the same service throws an error.
|
|
585
583
|
|
|
586
584
|
**Delivery guarantee**: once a message is accepted by the runtime, delivery to each consumer group
|
|
587
585
|
is guaranteed. If the consumer is offline, the message waits in the server-side queue and is
|
package/dist/index.js
CHANGED
|
@@ -859,7 +859,7 @@ function servicebridge(url, serviceKey, serviceOrOpts = {}, maybeGlobalOpts = {}
|
|
|
859
859
|
const service = typeof serviceOrOpts === "string" ? serviceOrOpts.trim() : "";
|
|
860
860
|
const globalOpts = typeof serviceOrOpts === "string" ? maybeGlobalOpts : serviceOrOpts ?? {};
|
|
861
861
|
const parsedServiceKey = parseServiceKeyV2(serviceKey);
|
|
862
|
-
const defaultConsumerPrefix =
|
|
862
|
+
const defaultConsumerPrefix = parsedServiceKey.keyId || "consumer";
|
|
863
863
|
const meta = new grpc.Metadata;
|
|
864
864
|
meta.add("x-service-key", serviceKey);
|
|
865
865
|
const rawUrl = url.trim();
|
|
@@ -1396,7 +1396,7 @@ function servicebridge(url, serviceKey, serviceOrOpts = {}, maybeGlobalOpts = {}
|
|
|
1396
1396
|
headers: toWireStringMap(op.opts?.headers),
|
|
1397
1397
|
trace_id: op.opts?.traceId ?? "",
|
|
1398
1398
|
parent_span_id: op.opts?.parentSpanId ?? "",
|
|
1399
|
-
producer_service:
|
|
1399
|
+
producer_service: defaultConsumerPrefix,
|
|
1400
1400
|
idempotency_key: op.opts?.idempotencyKey ?? ""
|
|
1401
1401
|
}, meta, unaryDeadlineOptions(), (err) => err ? rej(err) : res());
|
|
1402
1402
|
});
|
|
@@ -2276,7 +2276,7 @@ function servicebridge(url, serviceKey, serviceOrOpts = {}, maybeGlobalOpts = {}
|
|
|
2276
2276
|
headers: toWireStringMap(opts?.headers),
|
|
2277
2277
|
trace_id: opts?.traceId ?? tc?.traceId ?? "",
|
|
2278
2278
|
parent_span_id: opts?.parentSpanId ?? tc?.spanId ?? "",
|
|
2279
|
-
producer_service:
|
|
2279
|
+
producer_service: defaultConsumerPrefix,
|
|
2280
2280
|
idempotency_key: opts?.idempotencyKey ?? ""
|
|
2281
2281
|
}, meta, unaryDeadlineOptions(), (err, res) => err ? reject(normalizeServiceError(err, `publish:${topic}`)) : resolve(res?.message_id ?? ""));
|
|
2282
2282
|
});
|
|
@@ -2317,9 +2317,9 @@ function servicebridge(url, serviceKey, serviceOrOpts = {}, maybeGlobalOpts = {}
|
|
|
2317
2317
|
},
|
|
2318
2318
|
handleEvent(pattern, handler, opts) {
|
|
2319
2319
|
const normalizedOpts = opts ?? {};
|
|
2320
|
-
const groupName =
|
|
2320
|
+
const groupName = `${defaultConsumerPrefix}.${pattern}`;
|
|
2321
2321
|
if (eventHandlers.has(groupName)) {
|
|
2322
|
-
throw new Error(`Duplicate event consumer group "${groupName}". ` + "Use a
|
|
2322
|
+
throw new Error(`Duplicate event consumer group "${groupName}". ` + "Use handleEvent() with a unique topic pattern per handler.");
|
|
2323
2323
|
}
|
|
2324
2324
|
eventHandlers.set(groupName, {
|
|
2325
2325
|
groupName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "service-bridge",
|
|
3
|
-
"version": "1.8.2-dev.
|
|
3
|
+
"version": "1.8.2-dev.39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ServiceBridge SDK for Node.js — one self-hosted runtime for RPC, events, workflows, and jobs without a service mesh or sidecars. Direct gRPC between workers; durable events, jobs, tracing, auto mTLS. One Go runtime + PostgreSQL.",
|
|
6
6
|
"keywords": [
|