@camunda8/orchestration-cluster-api 8.9.0-alpha.22 → 8.9.0-alpha.23
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/CHANGELOG.md +19 -0
- package/README.md +63 -5
- package/dist/{chunk-7IUDW222.js → chunk-W7A45XXW.js} +129 -22
- package/dist/chunk-W7A45XXW.js.map +1 -0
- package/dist/fp/index.cjs +128 -21
- package/dist/fp/index.cjs.map +1 -1
- package/dist/fp/index.d.cts +1 -1
- package/dist/fp/index.d.ts +1 -1
- package/dist/fp/index.js +1 -1
- package/dist/{index-BmzsA8v5.d.cts → index-kEPhHRPZ.d.cts} +48 -8
- package/dist/{index-CoLIT6o0.d.ts → index-ofViYvpy.d.ts} +48 -8
- package/dist/index.cjs +128 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7IUDW222.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [8.9.0-alpha.23](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.22...v8.9.0-alpha.23) (2026-03-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* address PR review comments ([fd357d5](https://github.com/camunda/orchestration-cluster-api-js/commit/fd357d5938dbb0e22d18711087b26560a802494c))
|
|
7
|
+
* address PR review comments on heritable worker defaults ([efec39c](https://github.com/camunda/orchestration-cluster-api-js/commit/efec39c54c788f625f27f7be70c830321ff43ef6))
|
|
8
|
+
* **config:** add signedInt schema type for CAMUNDA_WORKER_REQUEST_TIMEOUT ([9f9f794](https://github.com/camunda/orchestration-cluster-api-js/commit/9f9f7949e3b1cfcf90ab8abf723595276c41a18d))
|
|
9
|
+
* **tests:** convert threaded handler fixtures to .js for Node 20 compat ([1e5f7b1](https://github.com/camunda/orchestration-cluster-api-js/commit/1e5f7b17931043adade84c7630264a1ed543cf2a))
|
|
10
|
+
* **threadedJobWorker:** extract validated fields to fix TS strict null errors ([7097cbd](https://github.com/camunda/orchestration-cluster-api-js/commit/7097cbde12076b8ba0d35208cedf7ebe1c891493))
|
|
11
|
+
* **threadPool:** don't pass TS strip flags to workers on Node < 22 ([dbf18d3](https://github.com/camunda/orchestration-cluster-api-js/commit/dbf18d3ab92ed1fd5fdf54988c1f613eaf7b09e3))
|
|
12
|
+
* use number types for int config overrides in tests and examples ([f7bfa2f](https://github.com/camunda/orchestration-cluster-api-js/commit/f7bfa2f3d9be5152d4cf9a1ca6d0d4f8c117e14b))
|
|
13
|
+
* wire README worker-defaults examples into snippet injection ([7759561](https://github.com/camunda/orchestration-cluster-api-js/commit/775956168f588dd02bf6e969ed641f3abb67e288))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* heritable worker defaults via CAMUNDA_WORKER_* env vars ([0311308](https://github.com/camunda/orchestration-cluster-api-js/commit/03113084fb15566bdf7d3bbb3d0d6e78ef582584))
|
|
19
|
+
|
|
1
20
|
# [8.9.0-alpha.22](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.21...v8.9.0-alpha.22) (2026-03-30)
|
|
2
21
|
|
|
3
22
|
|
package/README.md
CHANGED
|
@@ -613,11 +613,14 @@ To deny a task completion (reject the work):
|
|
|
613
613
|
<!-- snippet:ReadmeJobCorrectionsDenial -->
|
|
614
614
|
|
|
615
615
|
```ts
|
|
616
|
-
return job.complete(
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
616
|
+
return job.complete(
|
|
617
|
+
{},
|
|
618
|
+
{
|
|
619
|
+
type: 'userTask',
|
|
620
|
+
denied: true,
|
|
621
|
+
deniedReason: 'Insufficient documentation',
|
|
622
|
+
}
|
|
623
|
+
);
|
|
621
624
|
```
|
|
622
625
|
|
|
623
626
|
| Correctable attribute | Type | Clear value |
|
|
@@ -690,6 +693,61 @@ client.createJobWorker({
|
|
|
690
693
|
|
|
691
694
|
A value of `0` (the default) means no delay.
|
|
692
695
|
|
|
696
|
+
### Heritable Worker Defaults
|
|
697
|
+
|
|
698
|
+
When running many workers with the same base configuration, you can set global defaults via environment variables (or equivalent keys in `CamundaOptions.config`). These apply to every worker created by the client (both `createJobWorker` and `createThreadedJobWorker`) unless the individual worker config explicitly overrides them.
|
|
699
|
+
|
|
700
|
+
| Environment Variable | Worker Config Field | Type |
|
|
701
|
+
| ------------------------------------------ | -------------------------- | ------ |
|
|
702
|
+
| `CAMUNDA_WORKER_TIMEOUT` | `jobTimeoutMs` | number |
|
|
703
|
+
| `CAMUNDA_WORKER_MAX_CONCURRENT_JOBS` | `maxParallelJobs` | number |
|
|
704
|
+
| `CAMUNDA_WORKER_REQUEST_TIMEOUT` | `pollTimeoutMs` | number |
|
|
705
|
+
| `CAMUNDA_WORKER_NAME` | `workerName` | string |
|
|
706
|
+
| `CAMUNDA_WORKER_STARTUP_JITTER_MAX_SECONDS`| `startupJitterMaxSeconds` | number |
|
|
707
|
+
|
|
708
|
+
**Precedence:** explicit worker config value > `CAMUNDA_WORKER_*` (from environment variables or `CamundaOptions.config` overrides) > hardcoded default (where applicable).
|
|
709
|
+
|
|
710
|
+
Example — set defaults via environment:
|
|
711
|
+
|
|
712
|
+
```bash
|
|
713
|
+
export CAMUNDA_WORKER_TIMEOUT=30000
|
|
714
|
+
export CAMUNDA_WORKER_MAX_CONCURRENT_JOBS=8
|
|
715
|
+
export CAMUNDA_WORKER_NAME=order-service
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
<!-- snippet:ReadmeWorkerDefaultsEnv -->
|
|
719
|
+
```ts
|
|
720
|
+
// Workers inherit timeout, concurrency, and name from environment
|
|
721
|
+
const w1 = client.createJobWorker({
|
|
722
|
+
jobType: 'validate-order',
|
|
723
|
+
jobHandler: async (job) => job.complete(),
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
const w2 = client.createJobWorker({
|
|
727
|
+
jobType: 'ship-order',
|
|
728
|
+
jobHandler: async (job) => job.complete(),
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
// Per-worker override: this worker uses 32 concurrent jobs instead of the global 8
|
|
732
|
+
const w3 = client.createJobWorker({
|
|
733
|
+
jobType: 'bulk-import',
|
|
734
|
+
maxParallelJobs: 32,
|
|
735
|
+
jobHandler: async (job) => job.complete(),
|
|
736
|
+
});
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
You can also pass defaults programmatically via the client constructor:
|
|
740
|
+
|
|
741
|
+
<!-- snippet:ReadmeWorkerDefaultsClient -->
|
|
742
|
+
```ts
|
|
743
|
+
const client = createCamundaClient({
|
|
744
|
+
config: {
|
|
745
|
+
CAMUNDA_WORKER_TIMEOUT: 30000,
|
|
746
|
+
CAMUNDA_WORKER_MAX_CONCURRENT_JOBS: 8,
|
|
747
|
+
},
|
|
748
|
+
});
|
|
749
|
+
```
|
|
750
|
+
|
|
693
751
|
### Receipt Type (Unique Symbol)
|
|
694
752
|
|
|
695
753
|
Action methods return a unique symbol (not a string) to avoid accidental misuse and allow internal metrics. If you store the receipt, annotate its type as `JobActionReceipt` to preserve uniqueness:
|
|
@@ -118,6 +118,8 @@ var DEFAULT_LONGPOLL_TIMEOUT = 0;
|
|
|
118
118
|
var JobWorker = class {
|
|
119
119
|
_client;
|
|
120
120
|
_cfg;
|
|
121
|
+
_maxParallelJobs;
|
|
122
|
+
_jobTimeoutMs;
|
|
121
123
|
_name;
|
|
122
124
|
_activeJobs = 0;
|
|
123
125
|
_stopped = false;
|
|
@@ -128,6 +130,18 @@ var JobWorker = class {
|
|
|
128
130
|
constructor(client2, cfg) {
|
|
129
131
|
this._client = client2;
|
|
130
132
|
this._cfg = { pollIntervalMs: 1, autoStart: true, validateSchemas: false, ...cfg };
|
|
133
|
+
if (this._cfg.maxParallelJobs === void 0) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
"maxParallelJobs is required: set it on JobWorkerConfig or via CAMUNDA_WORKER_MAX_CONCURRENT_JOBS (environment variable or CamundaOptions.config override)."
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
if (this._cfg.jobTimeoutMs === void 0) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
"jobTimeoutMs is required: set it on JobWorkerConfig or via CAMUNDA_WORKER_TIMEOUT (environment variable or CamundaOptions.config override)."
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
this._maxParallelJobs = this._cfg.maxParallelJobs;
|
|
144
|
+
this._jobTimeoutMs = this._cfg.jobTimeoutMs;
|
|
131
145
|
this._name = cfg.workerName || `worker-${cfg.jobType}-${++_workerCounter}`;
|
|
132
146
|
this._log = this._client.logger().scope(`worker:${this._name}`);
|
|
133
147
|
if (cfg.maxBackoffTimeMs !== void 0) {
|
|
@@ -222,11 +236,11 @@ var JobWorker = class {
|
|
|
222
236
|
async _poll() {
|
|
223
237
|
this._pollTimer = null;
|
|
224
238
|
if (this._stopped) return;
|
|
225
|
-
if (this._activeJobs >= this.
|
|
239
|
+
if (this._activeJobs >= this._maxParallelJobs) {
|
|
226
240
|
this._scheduleNext(this._cfg.pollIntervalMs);
|
|
227
241
|
return;
|
|
228
242
|
}
|
|
229
|
-
const batchSize = this.
|
|
243
|
+
const batchSize = this._maxParallelJobs - this._activeJobs;
|
|
230
244
|
if (batchSize <= 0) {
|
|
231
245
|
this._scheduleNext(this._cfg.pollIntervalMs);
|
|
232
246
|
return;
|
|
@@ -236,7 +250,7 @@ var JobWorker = class {
|
|
|
236
250
|
worker: this._name,
|
|
237
251
|
maxJobsToActivate: batchSize,
|
|
238
252
|
requestTimeout: this._cfg.pollTimeoutMs ?? DEFAULT_LONGPOLL_TIMEOUT,
|
|
239
|
-
timeout: this.
|
|
253
|
+
timeout: this._jobTimeoutMs,
|
|
240
254
|
// API expects `fetchVariable`; map from config `fetchVariables`
|
|
241
255
|
...this._cfg.fetchVariables && this._cfg.fetchVariables.length > 0 ? { fetchVariable: this._cfg.fetchVariables } : {}
|
|
242
256
|
};
|
|
@@ -3651,6 +3665,27 @@ var SCHEMA = {
|
|
|
3651
3665
|
type: "boolean",
|
|
3652
3666
|
default: false,
|
|
3653
3667
|
doc: "Alias for CAMUNDA_SUPPORT_LOG_ENABLED (deprecated)."
|
|
3668
|
+
},
|
|
3669
|
+
// Worker defaults (heritable to all workers created via createJobWorker/createThreadedJobWorker)
|
|
3670
|
+
CAMUNDA_WORKER_TIMEOUT: {
|
|
3671
|
+
type: "int",
|
|
3672
|
+
doc: "Default job timeout in ms for all workers. Individual JobWorkerConfig.jobTimeoutMs overrides this."
|
|
3673
|
+
},
|
|
3674
|
+
CAMUNDA_WORKER_MAX_CONCURRENT_JOBS: {
|
|
3675
|
+
type: "int",
|
|
3676
|
+
doc: "Default max parallel jobs for all workers. Individual JobWorkerConfig.maxParallelJobs overrides this."
|
|
3677
|
+
},
|
|
3678
|
+
CAMUNDA_WORKER_REQUEST_TIMEOUT: {
|
|
3679
|
+
type: "signedInt",
|
|
3680
|
+
doc: "Default long-poll timeout in ms for all workers. Negative values cause activation to complete immediately when no jobs are available. Individual JobWorkerConfig.pollTimeoutMs overrides this."
|
|
3681
|
+
},
|
|
3682
|
+
CAMUNDA_WORKER_NAME: {
|
|
3683
|
+
type: "string",
|
|
3684
|
+
doc: "Default worker name for all workers. Individual JobWorkerConfig.workerName overrides this."
|
|
3685
|
+
},
|
|
3686
|
+
CAMUNDA_WORKER_STARTUP_JITTER_MAX_SECONDS: {
|
|
3687
|
+
type: "int",
|
|
3688
|
+
doc: "Default startup jitter in seconds for all workers. Individual JobWorkerConfig.startupJitterMaxSeconds overrides this."
|
|
3654
3689
|
}
|
|
3655
3690
|
};
|
|
3656
3691
|
function isSecret(key) {
|
|
@@ -3714,6 +3749,17 @@ function parseInteger(raw, key, errors) {
|
|
|
3714
3749
|
});
|
|
3715
3750
|
return void 0;
|
|
3716
3751
|
}
|
|
3752
|
+
function parseSignedInteger(raw, key, errors) {
|
|
3753
|
+
const v = raw.trim();
|
|
3754
|
+
if (v === "") return void 0;
|
|
3755
|
+
if (/^-?[0-9]+$/.test(v)) return parseInt(v, 10);
|
|
3756
|
+
errors.push({
|
|
3757
|
+
code: "CONFIG_INVALID_INTEGER" /* CONFIG_INVALID_INTEGER */,
|
|
3758
|
+
key,
|
|
3759
|
+
message: `Invalid integer '${raw}'. Only base-10 integers (optionally negative) allowed.`
|
|
3760
|
+
});
|
|
3761
|
+
return void 0;
|
|
3762
|
+
}
|
|
3717
3763
|
function parseValidation(raw, errors) {
|
|
3718
3764
|
const val = raw.trim();
|
|
3719
3765
|
if (val === "") return { req: "none", res: "none", raw: "req:none,res:none" };
|
|
@@ -3800,6 +3846,13 @@ function hydrateConfig(options = {}) {
|
|
|
3800
3846
|
return parsed;
|
|
3801
3847
|
};
|
|
3802
3848
|
}
|
|
3849
|
+
function signedIntParserFactory(key) {
|
|
3850
|
+
return (v) => {
|
|
3851
|
+
const parsed = parseSignedInteger(v, key, parseErrors);
|
|
3852
|
+
if (parsed === void 0) return void 0;
|
|
3853
|
+
return parsed;
|
|
3854
|
+
};
|
|
3855
|
+
}
|
|
3803
3856
|
function enumParserFactory(key, choices) {
|
|
3804
3857
|
const lowered = choices.map((c) => c.toLowerCase());
|
|
3805
3858
|
const allLower = choices.every((c) => c === c.toLowerCase());
|
|
@@ -3835,6 +3888,10 @@ function hydrateConfig(options = {}) {
|
|
|
3835
3888
|
const base = { parser: intParserFactory(k), ...baseOpt };
|
|
3836
3889
|
if (entry.default !== void 0) base.default = entry.default;
|
|
3837
3890
|
typedEnvSchema[k] = base;
|
|
3891
|
+
} else if (entry.type === "signedInt") {
|
|
3892
|
+
const base = { parser: signedIntParserFactory(k), ...baseOpt };
|
|
3893
|
+
if (entry.default !== void 0) base.default = entry.default;
|
|
3894
|
+
typedEnvSchema[k] = base;
|
|
3838
3895
|
} else if (entry.type === "enum") {
|
|
3839
3896
|
const base = { parser: enumParserFactory(k, entry.choices || []), ...baseOpt };
|
|
3840
3897
|
if (entry.default !== void 0) base.default = entry.default;
|
|
@@ -4097,6 +4154,13 @@ function hydrateConfig(options = {}) {
|
|
|
4097
4154
|
enabled: (rawMap.CAMUNDA_SUPPORT_LOG_ENABLED || "false").toString().toLowerCase() === "true",
|
|
4098
4155
|
filePath: rawMap.CAMUNDA_SUPPORT_LOG_FILE_PATH || (typeof process !== "undefined" && typeof process.cwd === "function" ? path.join(process.cwd(), "camunda-support.log") : "camunda-support.log")
|
|
4099
4156
|
},
|
|
4157
|
+
workerDefaults: rawMap.CAMUNDA_WORKER_TIMEOUT || rawMap.CAMUNDA_WORKER_MAX_CONCURRENT_JOBS || rawMap.CAMUNDA_WORKER_REQUEST_TIMEOUT || rawMap.CAMUNDA_WORKER_NAME || rawMap.CAMUNDA_WORKER_STARTUP_JITTER_MAX_SECONDS ? {
|
|
4158
|
+
jobTimeoutMs: rawMap.CAMUNDA_WORKER_TIMEOUT ? parseInt(rawMap.CAMUNDA_WORKER_TIMEOUT, 10) : void 0,
|
|
4159
|
+
maxParallelJobs: rawMap.CAMUNDA_WORKER_MAX_CONCURRENT_JOBS ? parseInt(rawMap.CAMUNDA_WORKER_MAX_CONCURRENT_JOBS, 10) : void 0,
|
|
4160
|
+
pollTimeoutMs: rawMap.CAMUNDA_WORKER_REQUEST_TIMEOUT ? parseInt(rawMap.CAMUNDA_WORKER_REQUEST_TIMEOUT, 10) : void 0,
|
|
4161
|
+
workerName: rawMap.CAMUNDA_WORKER_NAME || void 0,
|
|
4162
|
+
startupJitterMaxSeconds: rawMap.CAMUNDA_WORKER_STARTUP_JITTER_MAX_SECONDS ? parseInt(rawMap.CAMUNDA_WORKER_STARTUP_JITTER_MAX_SECONDS, 10) : void 0
|
|
4163
|
+
} : void 0,
|
|
4100
4164
|
__raw: { ...rawMap }
|
|
4101
4165
|
};
|
|
4102
4166
|
deepFreeze(config);
|
|
@@ -4343,7 +4407,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
|
|
|
4343
4407
|
}
|
|
4344
4408
|
|
|
4345
4409
|
// src/runtime/version.ts
|
|
4346
|
-
var packageVersion = "8.9.0-alpha.
|
|
4410
|
+
var packageVersion = "8.9.0-alpha.23";
|
|
4347
4411
|
|
|
4348
4412
|
// src/runtime/supportLogger.ts
|
|
4349
4413
|
var NoopSupportLogger = class {
|
|
@@ -5440,6 +5504,8 @@ var ThreadedJobWorker = class {
|
|
|
5440
5504
|
_client;
|
|
5441
5505
|
_pool;
|
|
5442
5506
|
_cfg;
|
|
5507
|
+
_maxParallelJobs;
|
|
5508
|
+
_jobTimeoutMs;
|
|
5443
5509
|
_name;
|
|
5444
5510
|
_activeJobs = 0;
|
|
5445
5511
|
_stopped = false;
|
|
@@ -5451,6 +5517,18 @@ var ThreadedJobWorker = class {
|
|
|
5451
5517
|
this._client = client2;
|
|
5452
5518
|
this._pool = pool;
|
|
5453
5519
|
this._cfg = { pollIntervalMs: 1, autoStart: true, validateSchemas: false, ...cfg };
|
|
5520
|
+
if (this._cfg.maxParallelJobs === void 0) {
|
|
5521
|
+
throw new Error(
|
|
5522
|
+
"maxParallelJobs is required: set it on ThreadedJobWorkerConfig or via CAMUNDA_WORKER_MAX_CONCURRENT_JOBS (environment variable or CamundaOptions.config override)."
|
|
5523
|
+
);
|
|
5524
|
+
}
|
|
5525
|
+
if (this._cfg.jobTimeoutMs === void 0) {
|
|
5526
|
+
throw new Error(
|
|
5527
|
+
"jobTimeoutMs is required: set it on ThreadedJobWorkerConfig or via CAMUNDA_WORKER_TIMEOUT (environment variable or CamundaOptions.config override)."
|
|
5528
|
+
);
|
|
5529
|
+
}
|
|
5530
|
+
this._maxParallelJobs = this._cfg.maxParallelJobs;
|
|
5531
|
+
this._jobTimeoutMs = this._cfg.jobTimeoutMs;
|
|
5454
5532
|
this._name = cfg.workerName || `threaded-worker-${cfg.jobType}-${++_workerCounter2}`;
|
|
5455
5533
|
this._log = this._client.logger().scope(`worker:${this._name}`);
|
|
5456
5534
|
this._pool.onThreadReady = () => this._drainQueue();
|
|
@@ -5633,11 +5711,11 @@ var ThreadedJobWorker = class {
|
|
|
5633
5711
|
this._pollTimer = null;
|
|
5634
5712
|
if (this._stopped) return;
|
|
5635
5713
|
await this._pool.ready;
|
|
5636
|
-
if (this._activeJobs >= this.
|
|
5714
|
+
if (this._activeJobs >= this._maxParallelJobs) {
|
|
5637
5715
|
this._scheduleNext(this._cfg.pollIntervalMs);
|
|
5638
5716
|
return;
|
|
5639
5717
|
}
|
|
5640
|
-
const batchSize = this.
|
|
5718
|
+
const batchSize = this._maxParallelJobs - this._activeJobs;
|
|
5641
5719
|
if (batchSize <= 0) {
|
|
5642
5720
|
this._scheduleNext(this._cfg.pollIntervalMs);
|
|
5643
5721
|
return;
|
|
@@ -5647,7 +5725,7 @@ var ThreadedJobWorker = class {
|
|
|
5647
5725
|
worker: this._name,
|
|
5648
5726
|
maxJobsToActivate: batchSize,
|
|
5649
5727
|
requestTimeout: this._cfg.pollTimeoutMs ?? DEFAULT_LONGPOLL_TIMEOUT2,
|
|
5650
|
-
timeout: this.
|
|
5728
|
+
timeout: this._jobTimeoutMs,
|
|
5651
5729
|
...this._cfg.fetchVariables && this._cfg.fetchVariables.length > 0 ? { fetchVariable: this._cfg.fetchVariables } : {}
|
|
5652
5730
|
};
|
|
5653
5731
|
this._log.debug(() => ["activation.request", { batchSize }]);
|
|
@@ -5773,7 +5851,6 @@ var ThreadPool = class {
|
|
|
5773
5851
|
_ready;
|
|
5774
5852
|
_terminated = false;
|
|
5775
5853
|
_entryPath = "";
|
|
5776
|
-
_execArgv = [];
|
|
5777
5854
|
_Worker;
|
|
5778
5855
|
_onThreadReady;
|
|
5779
5856
|
constructor(client2, size) {
|
|
@@ -5872,7 +5949,7 @@ var ThreadPool = class {
|
|
|
5872
5949
|
}
|
|
5873
5950
|
/** Create a single worker thread and wire up its event handlers. */
|
|
5874
5951
|
_spawnWorker() {
|
|
5875
|
-
const worker = new this._Worker(this._entryPath
|
|
5952
|
+
const worker = new this._Worker(this._entryPath);
|
|
5876
5953
|
const pw = { worker, busy: false, ready: false };
|
|
5877
5954
|
worker.on("message", (msg) => {
|
|
5878
5955
|
if (msg.type === "ready") {
|
|
@@ -5949,19 +6026,21 @@ var ThreadPool = class {
|
|
|
5949
6026
|
const url = await import("url");
|
|
5950
6027
|
const dir = typeof __dirname !== "undefined" ? __dirname : pathMod.dirname(url.fileURLToPath(import.meta.url));
|
|
5951
6028
|
const jsPath = join(dir, "threadWorkerEntry.js");
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
6029
|
+
if (fs.existsSync(jsPath)) {
|
|
6030
|
+
this._entryPath = jsPath;
|
|
6031
|
+
} else {
|
|
6032
|
+
const distPath = pathMod.resolve(dir, "..", "..", "dist", "threadWorkerEntry.js");
|
|
6033
|
+
if (!fs.existsSync(distPath)) {
|
|
6034
|
+
throw new Error(
|
|
6035
|
+
`threadWorkerEntry.js not found at ${jsPath} or ${distPath}. Run "npm run build" first.`
|
|
6036
|
+
);
|
|
6037
|
+
}
|
|
6038
|
+
this._entryPath = distPath;
|
|
6039
|
+
}
|
|
5961
6040
|
for (let i = 0; i < size; i++) {
|
|
5962
6041
|
this._pool.push(this._spawnWorker());
|
|
5963
6042
|
}
|
|
5964
|
-
this._log.info(() => ["thread-pool.init", { size, entryPath }]);
|
|
6043
|
+
this._log.info(() => ["thread-pool.init", { size, entryPath: this._entryPath }]);
|
|
5965
6044
|
}
|
|
5966
6045
|
};
|
|
5967
6046
|
|
|
@@ -16340,6 +16419,11 @@ var CamundaClient = class {
|
|
|
16340
16419
|
// === AUTO-GENERATED CAMUNDA METHODS END ===
|
|
16341
16420
|
/**
|
|
16342
16421
|
* Create a job worker that activates and processes jobs of the given type.
|
|
16422
|
+
*
|
|
16423
|
+
* Worker configuration fields inherit global defaults resolved via the
|
|
16424
|
+
* unified configuration (environment variables or equivalent `CAMUNDA_WORKER_*`
|
|
16425
|
+
* keys provided via `CamundaOptions.config`) when not explicitly set on the
|
|
16426
|
+
* config object.
|
|
16343
16427
|
* @param cfg Worker configuration
|
|
16344
16428
|
* @example Create a job worker
|
|
16345
16429
|
* {@includeCode ../../examples/job.ts#CreateJobWorker}
|
|
@@ -16347,7 +16431,16 @@ var CamundaClient = class {
|
|
|
16347
16431
|
* {@includeCode ../../examples/job.ts#JobWorkerWithErrorHandling}
|
|
16348
16432
|
*/
|
|
16349
16433
|
createJobWorker(cfg) {
|
|
16350
|
-
const
|
|
16434
|
+
const defaults = this._config.workerDefaults;
|
|
16435
|
+
const merged = defaults ? {
|
|
16436
|
+
...cfg,
|
|
16437
|
+
jobTimeoutMs: cfg.jobTimeoutMs ?? defaults.jobTimeoutMs,
|
|
16438
|
+
maxParallelJobs: cfg.maxParallelJobs ?? defaults.maxParallelJobs,
|
|
16439
|
+
pollTimeoutMs: cfg.pollTimeoutMs ?? defaults.pollTimeoutMs,
|
|
16440
|
+
workerName: cfg.workerName ?? defaults.workerName,
|
|
16441
|
+
startupJitterMaxSeconds: cfg.startupJitterMaxSeconds ?? defaults.startupJitterMaxSeconds
|
|
16442
|
+
} : cfg;
|
|
16443
|
+
const worker = new JobWorker(this, merged);
|
|
16351
16444
|
this._workers.push(worker);
|
|
16352
16445
|
return worker;
|
|
16353
16446
|
}
|
|
@@ -16359,6 +16452,11 @@ var CamundaClient = class {
|
|
|
16359
16452
|
* This keeps the main event loop free for polling and I/O, dramatically improving
|
|
16360
16453
|
* throughput for CPU-bound job handlers.
|
|
16361
16454
|
*
|
|
16455
|
+
* Worker configuration fields inherit global defaults resolved via the
|
|
16456
|
+
* unified configuration (environment variables or equivalent `CAMUNDA_WORKER_*`
|
|
16457
|
+
* keys provided via `CamundaOptions.config`) when not explicitly set on the
|
|
16458
|
+
* config object.
|
|
16459
|
+
*
|
|
16362
16460
|
* @param cfg Threaded worker configuration
|
|
16363
16461
|
* @example Create a threaded job worker
|
|
16364
16462
|
* ```ts
|
|
@@ -16371,8 +16469,17 @@ var CamundaClient = class {
|
|
|
16371
16469
|
* ```
|
|
16372
16470
|
*/
|
|
16373
16471
|
createThreadedJobWorker(cfg) {
|
|
16472
|
+
const defaults = this._config.workerDefaults;
|
|
16473
|
+
const merged = defaults ? {
|
|
16474
|
+
...cfg,
|
|
16475
|
+
jobTimeoutMs: cfg.jobTimeoutMs ?? defaults.jobTimeoutMs,
|
|
16476
|
+
maxParallelJobs: cfg.maxParallelJobs ?? defaults.maxParallelJobs,
|
|
16477
|
+
pollTimeoutMs: cfg.pollTimeoutMs ?? defaults.pollTimeoutMs,
|
|
16478
|
+
workerName: cfg.workerName ?? defaults.workerName,
|
|
16479
|
+
startupJitterMaxSeconds: cfg.startupJitterMaxSeconds ?? defaults.startupJitterMaxSeconds
|
|
16480
|
+
} : cfg;
|
|
16374
16481
|
const pool = this._getOrCreateThreadPool(cfg.threadPoolSize);
|
|
16375
|
-
const worker = new ThreadedJobWorker(this, pool,
|
|
16482
|
+
const worker = new ThreadedJobWorker(this, pool, merged);
|
|
16376
16483
|
this._workers.push(worker);
|
|
16377
16484
|
return worker;
|
|
16378
16485
|
}
|
|
@@ -16568,4 +16675,4 @@ export {
|
|
|
16568
16675
|
withTimeoutTE,
|
|
16569
16676
|
eventuallyTE
|
|
16570
16677
|
};
|
|
16571
|
-
//# sourceMappingURL=chunk-
|
|
16678
|
+
//# sourceMappingURL=chunk-W7A45XXW.js.map
|