nestjs-temporal-core 3.0.10 → 3.0.11
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 +1451 -721
- package/dist/constants.d.ts +49 -151
- package/dist/constants.js +38 -141
- package/dist/constants.js.map +1 -1
- package/dist/decorators/activity.decorator.js +75 -15
- package/dist/decorators/activity.decorator.js.map +1 -1
- package/dist/decorators/index.d.ts +1 -3
- package/dist/decorators/index.js +4 -13
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/workflow.decorator.d.ts +7 -3
- package/dist/decorators/workflow.decorator.js +161 -48
- package/dist/decorators/workflow.decorator.js.map +1 -1
- package/dist/health/temporal-health.controller.d.ts +7 -0
- package/dist/health/temporal-health.controller.js +77 -0
- package/dist/health/temporal-health.controller.js.map +1 -0
- package/dist/health/temporal-health.module.d.ts +2 -0
- package/dist/health/temporal-health.module.js +20 -0
- package/dist/health/temporal-health.module.js.map +1 -0
- package/dist/index.d.ts +10 -20
- package/dist/index.js +15 -30
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +740 -160
- package/dist/interfaces.js +1 -2
- package/dist/interfaces.js.map +1 -1
- package/dist/providers/temporal-connection.factory.d.ts +28 -0
- package/dist/providers/temporal-connection.factory.js +194 -0
- package/dist/providers/temporal-connection.factory.js.map +1 -0
- package/dist/services/temporal-client.service.d.ts +33 -0
- package/dist/services/temporal-client.service.js +285 -0
- package/dist/services/temporal-client.service.js.map +1 -0
- package/dist/services/temporal-discovery.service.d.ts +34 -0
- package/dist/services/temporal-discovery.service.js +348 -0
- package/dist/services/temporal-discovery.service.js.map +1 -0
- package/dist/services/temporal-metadata.service.d.ts +37 -0
- package/dist/services/temporal-metadata.service.js +512 -0
- package/dist/services/temporal-metadata.service.js.map +1 -0
- package/dist/services/temporal-schedule.service.d.ts +35 -0
- package/dist/services/temporal-schedule.service.js +380 -0
- package/dist/services/temporal-schedule.service.js.map +1 -0
- package/dist/services/temporal-worker.service.d.ts +54 -0
- package/dist/services/temporal-worker.service.js +605 -0
- package/dist/services/temporal-worker.service.js.map +1 -0
- package/dist/services/temporal.service.d.ts +85 -0
- package/dist/services/temporal.service.js +572 -0
- package/dist/services/temporal.service.js.map +1 -0
- package/dist/temporal.module.d.ts +6 -9
- package/dist/temporal.module.js +160 -109
- package/dist/temporal.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +5 -8
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logger.d.ts +10 -4
- package/dist/utils/logger.js +77 -106
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/metadata.d.ts +1 -3
- package/dist/utils/metadata.js +8 -18
- package/dist/utils/metadata.js.map +1 -1
- package/dist/utils/validation.d.ts +16 -2
- package/dist/utils/validation.js +103 -9
- package/dist/utils/validation.js.map +1 -1
- package/package.json +37 -26
- package/dist/activity/index.d.ts +0 -2
- package/dist/activity/index.js +0 -19
- package/dist/activity/index.js.map +0 -1
- package/dist/activity/temporal-activity.module.d.ts +0 -11
- package/dist/activity/temporal-activity.module.js +0 -52
- package/dist/activity/temporal-activity.module.js.map +0 -1
- package/dist/activity/temporal-activity.service.d.ts +0 -46
- package/dist/activity/temporal-activity.service.js +0 -192
- package/dist/activity/temporal-activity.service.js.map +0 -1
- package/dist/client/index.d.ts +0 -3
- package/dist/client/index.js +0 -20
- package/dist/client/index.js.map +0 -1
- package/dist/client/temporal-client.module.d.ts +0 -18
- package/dist/client/temporal-client.module.js +0 -198
- package/dist/client/temporal-client.module.js.map +0 -1
- package/dist/client/temporal-client.service.d.ts +0 -35
- package/dist/client/temporal-client.service.js +0 -187
- package/dist/client/temporal-client.service.js.map +0 -1
- package/dist/client/temporal-schedule.service.d.ts +0 -41
- package/dist/client/temporal-schedule.service.js +0 -204
- package/dist/client/temporal-schedule.service.js.map +0 -1
- package/dist/decorators/parameter.decorator.d.ts +0 -5
- package/dist/decorators/parameter.decorator.js +0 -57
- package/dist/decorators/parameter.decorator.js.map +0 -1
- package/dist/decorators/scheduling.decorator.d.ts +0 -4
- package/dist/decorators/scheduling.decorator.js +0 -44
- package/dist/decorators/scheduling.decorator.js.map +0 -1
- package/dist/discovery/index.d.ts +0 -2
- package/dist/discovery/index.js +0 -19
- package/dist/discovery/index.js.map +0 -1
- package/dist/discovery/temporal-discovery.service.d.ts +0 -39
- package/dist/discovery/temporal-discovery.service.js +0 -191
- package/dist/discovery/temporal-discovery.service.js.map +0 -1
- package/dist/discovery/temporal-schedule-manager.service.d.ts +0 -41
- package/dist/discovery/temporal-schedule-manager.service.js +0 -238
- package/dist/discovery/temporal-schedule-manager.service.js.map +0 -1
- package/dist/schedules/index.d.ts +0 -2
- package/dist/schedules/index.js +0 -19
- package/dist/schedules/index.js.map +0 -1
- package/dist/schedules/temporal-schedules.module.d.ts +0 -11
- package/dist/schedules/temporal-schedules.module.js +0 -55
- package/dist/schedules/temporal-schedules.module.js.map +0 -1
- package/dist/schedules/temporal-schedules.service.d.ts +0 -52
- package/dist/schedules/temporal-schedules.service.js +0 -221
- package/dist/schedules/temporal-schedules.service.js.map +0 -1
- package/dist/temporal.service.d.ts +0 -77
- package/dist/temporal.service.js +0 -243
- package/dist/temporal.service.js.map +0 -1
- package/dist/worker/index.d.ts +0 -3
- package/dist/worker/index.js +0 -20
- package/dist/worker/index.js.map +0 -1
- package/dist/worker/temporal-metadata.accessor.d.ts +0 -32
- package/dist/worker/temporal-metadata.accessor.js +0 -208
- package/dist/worker/temporal-metadata.accessor.js.map +0 -1
- package/dist/worker/temporal-worker-manager.service.d.ts +0 -49
- package/dist/worker/temporal-worker-manager.service.js +0 -389
- package/dist/worker/temporal-worker-manager.service.js.map +0 -1
- package/dist/worker/temporal-worker.module.d.ts +0 -18
- package/dist/worker/temporal-worker.module.js +0 -156
- package/dist/worker/temporal-worker.module.js.map +0 -1
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var TemporalWorkerManagerService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TemporalWorkerManagerService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const worker_1 = require("@temporalio/worker");
|
|
19
|
+
const constants_1 = require("../constants");
|
|
20
|
+
const temporal_discovery_service_1 = require("./temporal-discovery.service");
|
|
21
|
+
const logger_1 = require("../utils/logger");
|
|
22
|
+
let TemporalWorkerManagerService = TemporalWorkerManagerService_1 = class TemporalWorkerManagerService {
|
|
23
|
+
constructor(discoveryService, options, injectedConnection) {
|
|
24
|
+
this.discoveryService = discoveryService;
|
|
25
|
+
this.options = options;
|
|
26
|
+
this.injectedConnection = injectedConnection;
|
|
27
|
+
this.worker = null;
|
|
28
|
+
this.restartCount = 0;
|
|
29
|
+
this.maxRestarts = 3;
|
|
30
|
+
this.connection = null;
|
|
31
|
+
this.isInitialized = false;
|
|
32
|
+
this.isRunning = false;
|
|
33
|
+
this.lastError = null;
|
|
34
|
+
this.startedAt = null;
|
|
35
|
+
this.activities = new Map();
|
|
36
|
+
this.shutdownPromise = null;
|
|
37
|
+
this.logger = (0, logger_1.createLogger)(TemporalWorkerManagerService_1.name, {
|
|
38
|
+
enableLogger: options.enableLogger,
|
|
39
|
+
logLevel: options.logLevel,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async onModuleInit() {
|
|
43
|
+
try {
|
|
44
|
+
this.logger.debug('Initializing Temporal worker manager...');
|
|
45
|
+
if (!this.shouldInitializeWorker()) {
|
|
46
|
+
this.logger.info('Worker initialization skipped - no worker configuration provided');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const initResult = await this.initializeWorker();
|
|
50
|
+
this.isInitialized = initResult.success;
|
|
51
|
+
if (initResult.success) {
|
|
52
|
+
this.logger.info('Temporal worker manager initialized successfully');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.lastError = initResult.error?.message || 'Unknown initialization error';
|
|
56
|
+
this.logger.error('Failed to initialize worker manager', initResult.error);
|
|
57
|
+
if (this.options.allowConnectionFailure === true) {
|
|
58
|
+
this.logger.warn('Worker initialization failed but connection failures are allowed');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
throw initResult.error || new Error('Worker initialization failed');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
this.lastError = this.extractErrorMessage(error);
|
|
66
|
+
this.logger.error('Failed to initialize worker manager', error);
|
|
67
|
+
if (this.options.allowConnectionFailure === true) {
|
|
68
|
+
this.logger.warn('Worker initialization failed but connection failures are allowed');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async onApplicationBootstrap() {
|
|
75
|
+
if (this.worker && this.options.worker?.autoStart !== false) {
|
|
76
|
+
await this.startWorker();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async onModuleDestroy() {
|
|
80
|
+
await this.shutdownWorker();
|
|
81
|
+
}
|
|
82
|
+
async startWorker() {
|
|
83
|
+
if (!this.worker) {
|
|
84
|
+
throw new Error('Worker not initialized. Cannot start worker.');
|
|
85
|
+
}
|
|
86
|
+
if (this.isRunning) {
|
|
87
|
+
this.logger.warn('Worker is already running');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
this.logger.info('Starting Temporal worker...');
|
|
92
|
+
this.isRunning = true;
|
|
93
|
+
this.startedAt = new Date();
|
|
94
|
+
this.lastError = null;
|
|
95
|
+
this.restartCount = 0;
|
|
96
|
+
await this.runWorkerWithAutoRestart();
|
|
97
|
+
this.logger.info('Temporal worker started successfully');
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
this.lastError = this.extractErrorMessage(error);
|
|
101
|
+
this.logger.error('Failed to start worker', error);
|
|
102
|
+
this.isRunning = false;
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async runWorkerWithAutoRestart() {
|
|
107
|
+
if (!this.worker)
|
|
108
|
+
return;
|
|
109
|
+
try {
|
|
110
|
+
await new Promise((resolve, reject) => {
|
|
111
|
+
setImmediate(async () => {
|
|
112
|
+
try {
|
|
113
|
+
this.worker.run().catch((error) => {
|
|
114
|
+
this.lastError = this.extractErrorMessage(error);
|
|
115
|
+
this.logger.error('Worker run failed', error);
|
|
116
|
+
this.isRunning = false;
|
|
117
|
+
if (this.options.autoRestart !== false &&
|
|
118
|
+
this.restartCount < this.maxRestarts) {
|
|
119
|
+
this.restartCount++;
|
|
120
|
+
this.logger.info(`Auto-restart enabled, attempting to restart worker (attempt ${this.restartCount}/${this.maxRestarts}) in 1 second...`);
|
|
121
|
+
setTimeout(async () => {
|
|
122
|
+
try {
|
|
123
|
+
await this.autoRestartWorker();
|
|
124
|
+
}
|
|
125
|
+
catch (restartError) {
|
|
126
|
+
this.logger.error('Auto-restart failed', restartError);
|
|
127
|
+
}
|
|
128
|
+
}, 1000);
|
|
129
|
+
}
|
|
130
|
+
else if (this.restartCount >= this.maxRestarts) {
|
|
131
|
+
this.logger.error(`Max restart attempts (${this.maxRestarts}) exceeded. Stopping auto-restart.`);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
setTimeout(() => resolve(), 500);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
reject(error);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async autoRestartWorker() {
|
|
147
|
+
this.logger.info('Auto-restarting Temporal worker...');
|
|
148
|
+
try {
|
|
149
|
+
if (this.worker) {
|
|
150
|
+
await this.worker.shutdown();
|
|
151
|
+
}
|
|
152
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
153
|
+
this.isRunning = true;
|
|
154
|
+
this.startedAt = new Date();
|
|
155
|
+
this.lastError = null;
|
|
156
|
+
this.runWorkerWithAutoRestart();
|
|
157
|
+
this.logger.info('Temporal worker auto-restarted successfully');
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
this.lastError = this.extractErrorMessage(error);
|
|
161
|
+
this.logger.error('Auto-restart failed', error);
|
|
162
|
+
this.isRunning = false;
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async stopWorker() {
|
|
167
|
+
if (!this.worker || !this.isRunning) {
|
|
168
|
+
this.logger.debug('Worker is not running or not initialized');
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
this.logger.info('Stopping Temporal worker...');
|
|
173
|
+
await this.worker.shutdown();
|
|
174
|
+
this.isRunning = false;
|
|
175
|
+
this.startedAt = null;
|
|
176
|
+
this.logger.info('Temporal worker stopped successfully');
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
this.lastError = this.extractErrorMessage(error);
|
|
180
|
+
this.logger.error('Failed to stop worker gracefully', error);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async shutdown() {
|
|
184
|
+
await this.shutdownWorker();
|
|
185
|
+
}
|
|
186
|
+
async restartWorker() {
|
|
187
|
+
this.logger.info('Restarting Temporal worker...');
|
|
188
|
+
try {
|
|
189
|
+
await this.stopWorker();
|
|
190
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
191
|
+
await this.startWorker();
|
|
192
|
+
return {
|
|
193
|
+
success: true,
|
|
194
|
+
restartCount: this.restartCount,
|
|
195
|
+
maxRestarts: this.maxRestarts,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
this.lastError = this.extractErrorMessage(error);
|
|
200
|
+
this.logger.error('Failed to restart worker', error);
|
|
201
|
+
return {
|
|
202
|
+
success: false,
|
|
203
|
+
error: error instanceof Error ? error : new Error(this.lastError),
|
|
204
|
+
restartCount: this.restartCount,
|
|
205
|
+
maxRestarts: this.maxRestarts,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
getWorkerStatus() {
|
|
210
|
+
const uptime = this.startedAt ? Date.now() - this.startedAt.getTime() : undefined;
|
|
211
|
+
return {
|
|
212
|
+
isInitialized: this.isInitialized,
|
|
213
|
+
isRunning: this.isRunning,
|
|
214
|
+
isHealthy: this.isInitialized && !this.lastError && this.isRunning,
|
|
215
|
+
taskQueue: this.options.taskQueue || 'default',
|
|
216
|
+
namespace: this.options.connection?.namespace || 'default',
|
|
217
|
+
workflowSource: this.getWorkflowSource(),
|
|
218
|
+
activitiesCount: this.activities.size,
|
|
219
|
+
lastError: this.lastError || undefined,
|
|
220
|
+
startedAt: this.startedAt || undefined,
|
|
221
|
+
uptime,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
getRegisteredActivities() {
|
|
225
|
+
const result = {};
|
|
226
|
+
for (const [name, func] of this.activities.entries()) {
|
|
227
|
+
result[name] = func;
|
|
228
|
+
}
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
async registerActivitiesFromDiscovery() {
|
|
232
|
+
const errors = [];
|
|
233
|
+
let registeredCount = 0;
|
|
234
|
+
try {
|
|
235
|
+
let attempts = 0;
|
|
236
|
+
const maxAttempts = 30;
|
|
237
|
+
while (attempts < maxAttempts) {
|
|
238
|
+
const healthStatus = this.discoveryService.getHealthStatus();
|
|
239
|
+
if (healthStatus.isComplete) {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
243
|
+
attempts++;
|
|
244
|
+
}
|
|
245
|
+
const allActivities = this.discoveryService.getAllActivities();
|
|
246
|
+
for (const [activityName, handler] of Object.entries(allActivities)) {
|
|
247
|
+
try {
|
|
248
|
+
this.activities.set(activityName, handler);
|
|
249
|
+
registeredCount++;
|
|
250
|
+
this.logger.debug(`Registered activity: ${activityName}`);
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
254
|
+
errors.push({ activityName, error: errorMessage });
|
|
255
|
+
this.logger.warn(`Failed to register activity ${activityName}: ${errorMessage}`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
this.logger.info(`Registered ${registeredCount} activities from discovery service`);
|
|
259
|
+
return {
|
|
260
|
+
success: errors.length === 0,
|
|
261
|
+
registeredCount,
|
|
262
|
+
errors,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
267
|
+
this.logger.error('Failed to register activities from discovery', error);
|
|
268
|
+
return {
|
|
269
|
+
success: false,
|
|
270
|
+
registeredCount,
|
|
271
|
+
errors: [{ activityName: 'discovery', error: errorMessage }],
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
isWorkerAvailable() {
|
|
276
|
+
return this.worker !== null;
|
|
277
|
+
}
|
|
278
|
+
isWorkerRunning() {
|
|
279
|
+
return this.isRunning;
|
|
280
|
+
}
|
|
281
|
+
getStatus() {
|
|
282
|
+
return this.getWorkerStatus();
|
|
283
|
+
}
|
|
284
|
+
getHealthStatus() {
|
|
285
|
+
const uptime = this.startedAt ? Date.now() - this.startedAt.getTime() : undefined;
|
|
286
|
+
return {
|
|
287
|
+
isHealthy: this.isInitialized && !this.lastError && this.isRunning,
|
|
288
|
+
isRunning: this.isRunning,
|
|
289
|
+
isInitialized: this.isInitialized,
|
|
290
|
+
lastError: this.lastError || undefined,
|
|
291
|
+
uptime,
|
|
292
|
+
activitiesCount: this.activities.size,
|
|
293
|
+
restartCount: this.restartCount,
|
|
294
|
+
maxRestarts: this.maxRestarts,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
getStats() {
|
|
298
|
+
const uptime = this.startedAt ? Date.now() - this.startedAt.getTime() : undefined;
|
|
299
|
+
return {
|
|
300
|
+
isInitialized: this.isInitialized,
|
|
301
|
+
isRunning: this.isRunning,
|
|
302
|
+
activitiesCount: this.activities.size,
|
|
303
|
+
restartCount: this.restartCount,
|
|
304
|
+
maxRestarts: this.maxRestarts,
|
|
305
|
+
uptime,
|
|
306
|
+
startedAt: this.startedAt || undefined,
|
|
307
|
+
lastError: this.lastError || undefined,
|
|
308
|
+
taskQueue: this.options.taskQueue || 'default',
|
|
309
|
+
namespace: this.options.connection?.namespace || 'default',
|
|
310
|
+
workflowSource: this.getWorkflowSource(),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
validateConfiguration() {
|
|
314
|
+
if (!this.options.taskQueue) {
|
|
315
|
+
throw new Error('Task queue is required');
|
|
316
|
+
}
|
|
317
|
+
if (!this.options.connection?.address) {
|
|
318
|
+
throw new Error('Connection address is required');
|
|
319
|
+
}
|
|
320
|
+
if (this.options.worker?.workflowsPath && this.options.worker?.workflowBundle) {
|
|
321
|
+
throw new Error('Cannot specify both workflowsPath and workflowBundle');
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
getEnvironmentDefaults() {
|
|
325
|
+
return {
|
|
326
|
+
taskQueue: this.options.taskQueue || 'default',
|
|
327
|
+
namespace: this.options.connection?.namespace || 'default',
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
buildWorkerOptions() {
|
|
331
|
+
const baseOptions = this.getEnvironmentDefaults();
|
|
332
|
+
if (this.options.worker?.workflowsPath) {
|
|
333
|
+
Object.assign(baseOptions, { workflowsPath: this.options.worker.workflowsPath });
|
|
334
|
+
}
|
|
335
|
+
else if (this.options.worker?.workflowBundle) {
|
|
336
|
+
Object.assign(baseOptions, { workflowBundle: this.options.worker.workflowBundle });
|
|
337
|
+
}
|
|
338
|
+
const activitiesObj = {};
|
|
339
|
+
for (const [name, func] of this.activities.entries()) {
|
|
340
|
+
activitiesObj[name] = func;
|
|
341
|
+
}
|
|
342
|
+
Object.assign(baseOptions, { activities: activitiesObj });
|
|
343
|
+
if (this.options.worker?.workerOptions) {
|
|
344
|
+
Object.assign(baseOptions, this.options.worker.workerOptions);
|
|
345
|
+
}
|
|
346
|
+
return baseOptions;
|
|
347
|
+
}
|
|
348
|
+
async createConnection() {
|
|
349
|
+
if (this.injectedConnection) {
|
|
350
|
+
this.connection = this.injectedConnection;
|
|
351
|
+
this.logger.debug('Using injected connection');
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (!this.options.connection?.address) {
|
|
355
|
+
throw new Error('Connection address is required');
|
|
356
|
+
}
|
|
357
|
+
try {
|
|
358
|
+
const address = this.options.connection.address;
|
|
359
|
+
const connectOptions = {
|
|
360
|
+
address,
|
|
361
|
+
tls: this.options.connection.tls,
|
|
362
|
+
};
|
|
363
|
+
if (this.options.connection.apiKey) {
|
|
364
|
+
connectOptions.metadata = {
|
|
365
|
+
...(this.options.connection.metadata || {}),
|
|
366
|
+
authorization: `Bearer ${this.options.connection.apiKey}`,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
this.logger.debug(`Creating NativeConnection to ${address}`);
|
|
370
|
+
this.connection = await worker_1.NativeConnection.connect(connectOptions);
|
|
371
|
+
this.logger.info(`Connection established to ${address}`);
|
|
372
|
+
}
|
|
373
|
+
catch (error) {
|
|
374
|
+
this.logger.error('Failed to create connection', error);
|
|
375
|
+
if (this.options.allowConnectionFailure !== false) {
|
|
376
|
+
this.logger.warn('Worker connection failed - continuing without worker functionality');
|
|
377
|
+
this.connection = null;
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
throw error;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
async createWorker() {
|
|
384
|
+
await this.createConnection();
|
|
385
|
+
if (!this.connection) {
|
|
386
|
+
throw new Error('Connection not established');
|
|
387
|
+
}
|
|
388
|
+
const workerConfig = await this.createWorkerConfig();
|
|
389
|
+
const { Worker } = await Promise.resolve().then(() => require('@temporalio/worker'));
|
|
390
|
+
this.worker = await Worker.create(workerConfig);
|
|
391
|
+
}
|
|
392
|
+
logWorkerConfiguration() {
|
|
393
|
+
this.logger.debug(`Worker configuration: ${JSON.stringify(this.options.worker)}`);
|
|
394
|
+
}
|
|
395
|
+
async runWorkerLoop() {
|
|
396
|
+
if (!this.worker) {
|
|
397
|
+
throw new Error('Temporal worker not initialized');
|
|
398
|
+
}
|
|
399
|
+
try {
|
|
400
|
+
await this.worker.run();
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
this.logger.error('Worker execution failed', error);
|
|
404
|
+
throw new Error('Execution error');
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
startWorkerInBackground() {
|
|
408
|
+
if (this.worker && !this.isRunning) {
|
|
409
|
+
this.startWorker().catch((error) => {
|
|
410
|
+
this.logger.error('Background worker start failed', error);
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
shouldInitializeWorker() {
|
|
415
|
+
return Boolean(this.options.worker &&
|
|
416
|
+
(this.options.worker.workflowsPath ||
|
|
417
|
+
this.options.worker.workflowBundle ||
|
|
418
|
+
this.options.worker.activityClasses?.length));
|
|
419
|
+
}
|
|
420
|
+
async initializeWorker() {
|
|
421
|
+
if (!this.options.worker) {
|
|
422
|
+
return {
|
|
423
|
+
success: false,
|
|
424
|
+
error: new Error('Worker configuration is required'),
|
|
425
|
+
activitiesCount: 0,
|
|
426
|
+
taskQueue: this.options.taskQueue || 'default',
|
|
427
|
+
namespace: this.options.connection?.namespace || 'default',
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
try {
|
|
431
|
+
this.validateConfiguration();
|
|
432
|
+
await this.createConnection();
|
|
433
|
+
if (!this.connection && this.options.allowConnectionFailure !== false) {
|
|
434
|
+
this.logger.info('Worker initialization skipped due to connection failure');
|
|
435
|
+
return {
|
|
436
|
+
success: false,
|
|
437
|
+
error: new Error('No worker connection available'),
|
|
438
|
+
activitiesCount: 0,
|
|
439
|
+
taskQueue: this.options.taskQueue || 'default',
|
|
440
|
+
namespace: this.options.connection?.namespace || 'default',
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
await this.loadActivitiesFromDiscovery();
|
|
444
|
+
const workerConfig = await this.createWorkerConfig();
|
|
445
|
+
const { Worker } = await Promise.resolve().then(() => require('@temporalio/worker'));
|
|
446
|
+
this.worker = await Worker.create(workerConfig);
|
|
447
|
+
this.logger.debug(`Worker created - TaskQueue: ${workerConfig.taskQueue}, Activities: ${this.activities.size}, Source: ${this.getWorkflowSource()}`);
|
|
448
|
+
return {
|
|
449
|
+
success: true,
|
|
450
|
+
worker: this.worker,
|
|
451
|
+
activitiesCount: this.activities.size,
|
|
452
|
+
taskQueue: workerConfig.taskQueue,
|
|
453
|
+
namespace: workerConfig.namespace,
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
this.lastError = this.extractErrorMessage(error);
|
|
458
|
+
this.logger.error('Failed to initialize worker', error);
|
|
459
|
+
return {
|
|
460
|
+
success: false,
|
|
461
|
+
error: error instanceof Error ? error : new Error(this.lastError),
|
|
462
|
+
activitiesCount: this.activities.size,
|
|
463
|
+
taskQueue: this.options.taskQueue || 'default',
|
|
464
|
+
namespace: this.options.connection?.namespace || 'default',
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
async loadActivitiesFromDiscovery() {
|
|
469
|
+
const startTime = Date.now();
|
|
470
|
+
const errors = [];
|
|
471
|
+
let discoveredActivities = 0;
|
|
472
|
+
let loadedActivities = 0;
|
|
473
|
+
try {
|
|
474
|
+
let attempts = 0;
|
|
475
|
+
const maxAttempts = 30;
|
|
476
|
+
while (attempts < maxAttempts) {
|
|
477
|
+
const healthStatus = this.discoveryService.getHealthStatus();
|
|
478
|
+
if (healthStatus.isComplete) {
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
482
|
+
attempts++;
|
|
483
|
+
}
|
|
484
|
+
const allActivities = this.discoveryService.getAllActivities();
|
|
485
|
+
discoveredActivities = Object.keys(allActivities).length;
|
|
486
|
+
for (const [activityName, handler] of Object.entries(allActivities)) {
|
|
487
|
+
try {
|
|
488
|
+
this.activities.set(activityName, handler);
|
|
489
|
+
loadedActivities++;
|
|
490
|
+
this.logger.debug(`Loaded activity: ${activityName}`);
|
|
491
|
+
}
|
|
492
|
+
catch (error) {
|
|
493
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
494
|
+
errors.push({ component: activityName, error: errorMessage });
|
|
495
|
+
this.logger.warn(`Failed to load activity ${activityName}: ${errorMessage}`);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
this.logger.info(`Loaded ${loadedActivities} activities from discovery service`);
|
|
499
|
+
return {
|
|
500
|
+
success: errors.length === 0,
|
|
501
|
+
discoveredActivities,
|
|
502
|
+
loadedActivities,
|
|
503
|
+
errors,
|
|
504
|
+
duration: Date.now() - startTime,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
catch (error) {
|
|
508
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
509
|
+
this.logger.error('Failed to load activities from discovery', error);
|
|
510
|
+
return {
|
|
511
|
+
success: false,
|
|
512
|
+
discoveredActivities,
|
|
513
|
+
loadedActivities,
|
|
514
|
+
errors: [{ component: 'discovery', error: errorMessage }],
|
|
515
|
+
duration: Date.now() - startTime,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
async createWorkerConfig() {
|
|
520
|
+
const taskQueue = this.options.taskQueue || 'default';
|
|
521
|
+
const namespace = this.options.connection?.namespace || 'default';
|
|
522
|
+
if (!this.connection) {
|
|
523
|
+
throw new Error('Connection not established');
|
|
524
|
+
}
|
|
525
|
+
const config = {
|
|
526
|
+
taskQueue,
|
|
527
|
+
namespace,
|
|
528
|
+
connection: this.connection,
|
|
529
|
+
activities: Object.fromEntries(this.activities),
|
|
530
|
+
};
|
|
531
|
+
if (this.options.worker?.workflowsPath) {
|
|
532
|
+
config.workflowsPath = this.options.worker.workflowsPath;
|
|
533
|
+
this.logger.debug(`Using workflows from path: ${this.options.worker.workflowsPath}`);
|
|
534
|
+
}
|
|
535
|
+
else if (this.options.worker?.workflowBundle) {
|
|
536
|
+
config.workflowBundle = this.options.worker.workflowBundle;
|
|
537
|
+
this.logger.debug('Using workflow bundle');
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
this.logger.warn('No workflow configuration provided - worker will only handle activities');
|
|
541
|
+
}
|
|
542
|
+
if (this.options.worker?.workerOptions) {
|
|
543
|
+
Object.assign(config, this.options.worker.workerOptions);
|
|
544
|
+
}
|
|
545
|
+
return config;
|
|
546
|
+
}
|
|
547
|
+
async shutdownWorker() {
|
|
548
|
+
if (this.shutdownPromise) {
|
|
549
|
+
return this.shutdownPromise;
|
|
550
|
+
}
|
|
551
|
+
this.shutdownPromise = this.performShutdown();
|
|
552
|
+
return this.shutdownPromise;
|
|
553
|
+
}
|
|
554
|
+
async performShutdown() {
|
|
555
|
+
try {
|
|
556
|
+
this.logger.info('Shutting down Temporal worker...');
|
|
557
|
+
if (this.worker) {
|
|
558
|
+
await this.stopWorker();
|
|
559
|
+
this.worker = null;
|
|
560
|
+
}
|
|
561
|
+
if (this.connection && !this.injectedConnection) {
|
|
562
|
+
try {
|
|
563
|
+
await this.connection.close();
|
|
564
|
+
this.logger.info('Connection closed successfully');
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
this.logger.warn('Error closing connection', error);
|
|
568
|
+
}
|
|
569
|
+
this.connection = null;
|
|
570
|
+
}
|
|
571
|
+
this.isInitialized = false;
|
|
572
|
+
this.logger.info('Worker shutdown completed');
|
|
573
|
+
}
|
|
574
|
+
catch (error) {
|
|
575
|
+
this.logger.error('Error during worker shutdown', error);
|
|
576
|
+
}
|
|
577
|
+
finally {
|
|
578
|
+
this.shutdownPromise = null;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
getWorkflowSource() {
|
|
582
|
+
if (this.options.worker?.workflowBundle)
|
|
583
|
+
return 'bundle';
|
|
584
|
+
if (this.options.worker?.workflowsPath)
|
|
585
|
+
return 'filesystem';
|
|
586
|
+
return 'none';
|
|
587
|
+
}
|
|
588
|
+
extractErrorMessage(error) {
|
|
589
|
+
if (error instanceof Error) {
|
|
590
|
+
return error.message;
|
|
591
|
+
}
|
|
592
|
+
if (typeof error === 'string') {
|
|
593
|
+
return error;
|
|
594
|
+
}
|
|
595
|
+
return 'Unknown error';
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
exports.TemporalWorkerManagerService = TemporalWorkerManagerService;
|
|
599
|
+
exports.TemporalWorkerManagerService = TemporalWorkerManagerService = TemporalWorkerManagerService_1 = __decorate([
|
|
600
|
+
(0, common_1.Injectable)(),
|
|
601
|
+
__param(1, (0, common_1.Inject)(constants_1.TEMPORAL_MODULE_OPTIONS)),
|
|
602
|
+
__param(2, (0, common_1.Inject)(constants_1.TEMPORAL_CONNECTION)),
|
|
603
|
+
__metadata("design:paramtypes", [temporal_discovery_service_1.TemporalDiscoveryService, Object, Object])
|
|
604
|
+
], TemporalWorkerManagerService);
|
|
605
|
+
//# sourceMappingURL=temporal-worker.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal-worker.service.js","sourceRoot":"","sources":["../../src/services/temporal-worker.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAMwB;AACxB,+CAA8D;AAC9D,4CAA4E;AAY5E,6EAAwE;AACxE,4CAA+D;AAYxD,IAAM,4BAA4B,oCAAlC,MAAM,4BAA4B;IAerC,YACqB,gBAA0C,EAE3D,OAAyC,EAEzC,kBAA4D;QAJ3C,qBAAgB,GAAhB,gBAAgB,CAA0B;QAE1C,YAAO,GAAP,OAAO,CAAiB;QAExB,uBAAkB,GAAlB,kBAAkB,CAAyB;QAhBxD,WAAM,GAAkB,IAAI,CAAC;QAC7B,iBAAY,GAAG,CAAC,CAAC;QACR,gBAAW,GAAG,CAAC,CAAC;QACzB,eAAU,GAA4B,IAAI,CAAC;QAC3C,kBAAa,GAAG,KAAK,CAAC;QACtB,cAAS,GAAG,KAAK,CAAC;QAClB,cAAS,GAAkB,IAAI,CAAC;QAChC,cAAS,GAAgB,IAAI,CAAC;QACrB,eAAU,GAAG,IAAI,GAAG,EAAoB,CAAC;QAClD,oBAAe,GAAyB,IAAI,CAAC;QASjD,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAY,EAAC,8BAA4B,CAAC,IAAI,EAAE;YAC1D,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC7B,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,YAAY;QACd,IAAI,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAE7D,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE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