blob: 4ce95c56f32c1b49203c00d2e98780f4ed425127 [file] [log] [blame]
Illyoung Choi59820ed2019-06-24 17:01:00 -07001/*
2 * Copyright 2019-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18(function () {
19 'use strict';
20
21 const _ = require('lodash');
22 const Workflow = require('../types/workflow.js');
23 const logger = require('../config/logger.js');
24
25 let serviceEvents = {
Illyoung Choib4fc0d82019-07-16 10:29:39 -070026 // manager -> controller -> manager
27 WORKFLOW_REGISTER: 'cord.workflow.ctlsvc.workflow.register',
28 WORKFLOW_REGISTER_ESSENCE: 'cord.workflow.ctlsvc.workflow.register_essence',
Illyoung Choi59820ed2019-06-24 17:01:00 -070029 WORKFLOW_LIST: 'cord.workflow.ctlsvc.workflow.list',
Illyoung Choib4fc0d82019-07-16 10:29:39 -070030 WORKFLOW_LIST_RUN: 'cord.workflow.ctlsvc.workflow.run.list',
Illyoung Choi59820ed2019-06-24 17:01:00 -070031 WORKFLOW_CHECK: 'cord.workflow.ctlsvc.workflow.check',
Illyoung Choi59820ed2019-06-24 17:01:00 -070032 WORKFLOW_REMOVE: 'cord.workflow.ctlsvc.workflow.remove',
Illyoung Choib4fc0d82019-07-16 10:29:39 -070033 WORKFLOW_REMOVE_RUN: 'cord.workflow.ctlsvc.workflow.run.remove',
Illyoung Choic707c052019-07-18 13:50:49 -070034 WORKFLOW_REPORT_NEW_RUN: 'cord.workflow.ctlsvc.workflow.report_new_run',
Illyoung Choiab109032019-07-29 14:04:10 -070035 WORKFLOW_REPORT_RUN_STATUS: 'cord.workflow.ctlsvc.workflow.report_run_status',
36 WORKFLOW_REPORT_RUN_STATUS_BULK: 'cord.workflow.ctlsvc.workflow.report_run_status_bulk',
Illyoung Choib4fc0d82019-07-16 10:29:39 -070037 // controller -> manager
Illyoung Choic707c052019-07-18 13:50:49 -070038 WORKFLOW_KICKSTART: 'cord.workflow.ctlsvc.workflow.kickstart',
Illyoung Choiab109032019-07-29 14:04:10 -070039 WORKFLOW_CHECK_STATUS: 'cord.workflow.ctlsvc.workflow.check.status',
40 WORKFLOW_CHECK_STATUS_BULK: 'cord.workflow.ctlsvc.workflow.check.status_bulk',
Illyoung Choi59820ed2019-06-24 17:01:00 -070041 };
42
43 // WebSocket interface for workflow registration
44 // Message format:
45 // {
46 // topic: 'cord.workflow.ctlsvc.workflow.reg',
Illyoung Choie3ce4cf2019-06-28 11:07:47 -070047 // message: {
Illyoung Choib4fc0d82019-07-16 10:29:39 -070048 // req_id: <req_id>, // optional
Illyoung Choie3ce4cf2019-06-28 11:07:47 -070049 // workflow: <workflow>
50 // }
Illyoung Choi59820ed2019-06-24 17:01:00 -070051 // }
Illyoung Choie3ce4cf2019-06-28 11:07:47 -070052 const registerWorkflow = (topic, message, cb) => {
Illyoung Choib4fc0d82019-07-16 10:29:39 -070053 const eventrouter = require('./eventrouter.js');
Illyoung Choi59820ed2019-06-24 17:01:00 -070054
55 let errorMessage;
56 if(!message) {
57 // error
58 errorMessage = `Message body for topic ${topic} is null or empty`;
59 logger.log('warn', `Return error - ${errorMessage}`);
60 cb(errorMessage, false);
61 return;
62 }
63
Illyoung Choie3ce4cf2019-06-28 11:07:47 -070064 if(!('workflow' in message)) {
65 // error
66 errorMessage = `field 'workflow' does not exist in message body - ${JSON.stringify(message)}`;
67 logger.log('warn', `Return error - ${errorMessage}`);
68 cb(errorMessage, false);
69 return;
70 }
71
72 let workflow = message.workflow;
Illyoung Choi59820ed2019-06-24 17:01:00 -070073
74 logger.log('debug', `workflow - ${JSON.stringify(workflow)}`);
75
Illyoung Choib4fc0d82019-07-16 10:29:39 -070076 let result = eventrouter.addWorkflow(workflow);
Illyoung Choi59820ed2019-06-24 17:01:00 -070077 if(!result) {
78 errorMessage = `failed to register a workflow ${workflow.getId()}`;
79 cb(errorMessage, false);
80 }
81 else {
82 cb(null, true);
83 }
84 return;
85 };
86
87 // WebSocket interface for workflow registration (via essence)
88 // Message format:
89 // {
Illyoung Choie3ce4cf2019-06-28 11:07:47 -070090 // topic: 'cord.workflow.ctlsvc.workflow.reg_essence',
91 // message: {
92 // req_id: <req_id> // optional
93 // essence: <workflow essence>
94 // }
Illyoung Choi59820ed2019-06-24 17:01:00 -070095 // }
96 const registerWorkflowEssence = (topic, message, cb) => {
97 const eventrouter = require('./eventrouter.js');
98 let errorMessage;
99 if(!message) {
100 // error
101 errorMessage = `Message body for topic ${topic} is null or empty`;
102 logger.log('warn', `Return error - ${errorMessage}`);
103 cb(errorMessage, false);
104 return;
105 }
106
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700107 if(!('essence' in message)) {
108 // error
109 errorMessage = `field 'essence' does not exist in message body - ${JSON.stringify(message)}`;
110 logger.log('warn', `Return error - ${errorMessage}`);
111 cb(errorMessage, false);
112 return;
113 }
114
115 let essence = message.essence;
Illyoung Choi59820ed2019-06-24 17:01:00 -0700116 let result = true;
117 let errorResults = [];
118
119 logger.log('debug', `workflow essence - ${JSON.stringify(essence)}`);
120
121 let workflows = Workflow.loadWorkflowsFromEssence(essence);
122 workflows.forEach((workflow) => {
123 if(workflow) {
124 let localResult = eventrouter.addWorkflow(workflow);
125 errorResults.push(localResult);
126 result = result && localResult; // false if any of registrations fails
127 }
128 });
129
130 if(!result) {
131 errorMessage = `failed to register workflows ${errorResults}`;
132 cb(errorMessage, false);
133 }
134 else {
135 cb(null, true);
136 }
137 return;
138 };
139
140 // WebSocket interface for workflow listing
141 // Message format:
142 // {
143 // topic: 'cord.workflow.ctlsvc.workflow.list',
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700144 // message: {
145 // req_id: <req_id> // optional
146 // }
Illyoung Choi59820ed2019-06-24 17:01:00 -0700147 // }
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700148 const listWorkflows = (_topic, _message, cb) => {
Illyoung Choi59820ed2019-06-24 17:01:00 -0700149 const eventrouter = require('./eventrouter.js');
150
151 let result = eventrouter.listWorkflows();
152 cb(null, result);
153 return;
154 };
155
156 // WebSocket interface for workflow run listing
157 // Message format:
158 // {
159 // topic: 'cord.workflow.ctlsvc.workflow.list',
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700160 // message: {
161 // req_id: <req_id> // optional
162 // }
Illyoung Choi59820ed2019-06-24 17:01:00 -0700163 // }
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700164 const listWorkflowRuns = (_topic, _message, cb) => {
Illyoung Choi59820ed2019-06-24 17:01:00 -0700165 const eventrouter = require('./eventrouter.js');
166
167 let result = eventrouter.listWorkflowRuns();
168 cb(null, result);
169 return;
170 };
171
172 // WebSocket interface for workflow check
173 // Message format:
174 // {
175 // topic: 'cord.workflow.ctlsvc.workflow.check',
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700176 // message: {
177 // req_id: <req_id> // optional
178 // workflow_id: <workflow_id>
179 // }
Illyoung Choi59820ed2019-06-24 17:01:00 -0700180 // }
181 const checkWorkflow = (topic, message, cb) => {
182 const eventrouter = require('./eventrouter.js');
183
184 let errorMessage;
185 if(!message) {
186 // error
187 errorMessage = `Message body for topic ${topic} is null or empty`;
188 logger.log('warn', `Return error - ${errorMessage}`);
189 cb(errorMessage, false);
190 return;
191 }
192
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700193 if(!('workflow_id' in message)) {
194 // error
195 errorMessage = `field 'workflow_id' does not exist in message body - ${JSON.stringify(message)}`;
196 logger.log('warn', `Return error - ${errorMessage}`);
197 cb(errorMessage, false);
198 return;
199 }
200
201 let workflowId = message.workflow_id;
Illyoung Choi59820ed2019-06-24 17:01:00 -0700202 let result = eventrouter.checkWorkflow(workflowId);
203 cb(null, result);
204 return;
205 };
206
Illyoung Choi59820ed2019-06-24 17:01:00 -0700207 // WebSocket interface for workflow removal
208 // Message format:
209 // {
210 // topic: 'cord.workflow.ctlsvc.workflow.remove',
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700211 // message: {
212 // req_id: <req_id> // optional
213 // workflow_id: <workflow_id>
214 // }
Illyoung Choi59820ed2019-06-24 17:01:00 -0700215 // }
216 const removeWorkflow = (topic, message, cb) => {
217 const eventrouter = require('./eventrouter.js');
218
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700219 let errorMessage;
220 if(!message) {
221 // error
222 errorMessage = `Message body for topic ${topic} is null or empty`;
223 logger.log('warn', `Return error - ${errorMessage}`);
224 cb(errorMessage, false);
225 return;
226 }
227
228 if(!('workflow_id' in message)) {
229 // error
230 errorMessage = `field 'workflow_id' does not exist in message body - ${JSON.stringify(message)}`;
231 logger.log('warn', `Return error - ${errorMessage}`);
232 cb(errorMessage, false);
233 return;
234 }
235
236 let workflowId = message.workflow_id;
Illyoung Choi59820ed2019-06-24 17:01:00 -0700237 let result = eventrouter.removeWorkflow(workflowId);
238 cb(null, result);
239 return;
Illyoung Choic707c052019-07-18 13:50:49 -0700240 };
Illyoung Choi59820ed2019-06-24 17:01:00 -0700241
242 // WebSocket interface for workflow run removal
243 // Message format:
244 // {
245 // topic: 'cord.workflow.ctlsvc.workflow.run.remove',
246 // message: {
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700247 // req_id: <req_id> // optional
248 // workflow_id: <workflow_id>,
249 // workflow_run_id: <workflow_run_id>
Illyoung Choi59820ed2019-06-24 17:01:00 -0700250 // }
251 // }
252 const removeWorkflowRun = (topic, message, cb) => {
253 const eventrouter = require('./eventrouter.js');
254
255 let errorMessage;
256 if(!message) {
257 // error
258 errorMessage = `Message body for topic ${topic} is null or empty`;
259 logger.log('warn', `Return error - ${errorMessage}`);
260 cb(errorMessage, false);
261 return;
262 }
263
264 if(!('workflow_id' in message)) {
265 // error
266 errorMessage = `field 'workflow_id' does not exist in message body - ${JSON.stringify(message)}`;
267 logger.log('warn', `Return error - ${errorMessage}`);
268 cb(errorMessage, false);
269 return;
270 }
271
272 if(!('workflow_run_id' in message)) {
273 // error
274 errorMessage = `field 'workflow_run_id' does not exist in message body - ${JSON.stringify(message)}`;
275 logger.log('warn', `Return error - ${errorMessage}`);
276 cb(errorMessage, false);
277 return;
278 }
279
280 let workflowRunId = message.workflow_run_id;
281
282 let result = eventrouter.removeWorkflowRun(workflowRunId);
283 cb(null, result);
284 return;
Illyoung Choic707c052019-07-18 13:50:49 -0700285 };
Illyoung Choi59820ed2019-06-24 17:01:00 -0700286
Illyoung Choic707c052019-07-18 13:50:49 -0700287 // WebSocket interface for reporting a new workflow run
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700288 // Message format:
289 // {
Illyoung Choic707c052019-07-18 13:50:49 -0700290 // topic: 'cord.workflow.ctlsvc.workflow.report_new_run',
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700291 // message: {
292 // req_id: <req_id> // optional
293 // workflow_id: <workflow_id>,
294 // workflow_run_id: <workflow_run_id>
295 // }
296 // }
Illyoung Choic707c052019-07-18 13:50:49 -0700297 const reportNewWorkflowRun = (topic, message, cb) => {
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700298 const eventrouter = require('./eventrouter.js');
299
300 let errorMessage;
301 if(!message) {
302 // error
303 errorMessage = `Message body for topic ${topic} is null or empty`;
304 logger.log('warn', `Return error - ${errorMessage}`);
305 cb(errorMessage, false);
306 return;
307 }
308
309 if(!('workflow_id' in message)) {
310 // error
311 errorMessage = `field 'workflow_id' does not exist in message body - ${JSON.stringify(message)}`;
312 logger.log('warn', `Return error - ${errorMessage}`);
313 cb(errorMessage, false);
314 return;
315 }
316
317 if(!('workflow_run_id' in message)) {
318 // error
319 errorMessage = `field 'workflow_run_id' does not exist in message body - ${JSON.stringify(message)}`;
320 logger.log('warn', `Return error - ${errorMessage}`);
321 cb(errorMessage, false);
322 return;
323 }
324
325 let workflowRunId = message.workflow_run_id;
326
327 // there must be a workflow matching
328 // set the workflow kickstarted
329 let result = eventrouter.setWorkflowRunKickstarted(workflowRunId);
330 cb(null, result);
331 return;
Illyoung Choic707c052019-07-18 13:50:49 -0700332 };
333
Illyoung Choiab109032019-07-29 14:04:10 -0700334 // WebSocket interface for reporting workflow run status
Illyoung Choic707c052019-07-18 13:50:49 -0700335 // Message format:
336 // {
Illyoung Choiab109032019-07-29 14:04:10 -0700337 // topic: 'cord.workflow.ctlsvc.workflow.report_run_status',
Illyoung Choic707c052019-07-18 13:50:49 -0700338 // message: {
339 // req_id: <req_id> // optional
340 // workflow_id: <workflow_id>,
341 // workflow_run_id: <workflow_run_id>,
Illyoung Choiab109032019-07-29 14:04:10 -0700342 // status: one of ['success', 'running', 'failed', 'unknown']
Illyoung Choic707c052019-07-18 13:50:49 -0700343 // }
344 // }
Illyoung Choiab109032019-07-29 14:04:10 -0700345 const reportWorkflowRunStatus = (topic, message, cb) => {
Illyoung Choic707c052019-07-18 13:50:49 -0700346 const eventrouter = require('./eventrouter.js');
347
348 let errorMessage;
349 if(!message) {
350 // error
351 errorMessage = `Message body for topic ${topic} is null or empty`;
352 logger.log('warn', `Return error - ${errorMessage}`);
353 cb(errorMessage, false);
354 return;
355 }
356
357 if(!('workflow_id' in message)) {
358 // error
359 errorMessage = `field 'workflow_id' does not exist in message body - ${JSON.stringify(message)}`;
360 logger.log('warn', `Return error - ${errorMessage}`);
361 cb(errorMessage, false);
362 return;
363 }
364
365 if(!('workflow_run_id' in message)) {
366 // error
367 errorMessage = `field 'workflow_run_id' does not exist in message body - ${JSON.stringify(message)}`;
368 logger.log('warn', `Return error - ${errorMessage}`);
369 cb(errorMessage, false);
370 return;
371 }
372
Illyoung Choiab109032019-07-29 14:04:10 -0700373 if(!('status' in message)) {
Illyoung Choic707c052019-07-18 13:50:49 -0700374 // error
Illyoung Choiab109032019-07-29 14:04:10 -0700375 errorMessage = `field 'status' does not exist in message body - ${JSON.stringify(message)}`;
Illyoung Choic707c052019-07-18 13:50:49 -0700376 logger.log('warn', `Return error - ${errorMessage}`);
377 cb(errorMessage, false);
378 return;
379 }
380
381 let workflowRunId = message.workflow_run_id;
Illyoung Choiab109032019-07-29 14:04:10 -0700382 let status = message.status;
Illyoung Choic707c052019-07-18 13:50:49 -0700383
384 // there must be a workflow matching
Illyoung Choiab109032019-07-29 14:04:10 -0700385 // set workflow status
386 let result = eventrouter.setWorkflowRunStatus(workflowRunId, status);
Illyoung Choic707c052019-07-18 13:50:49 -0700387 cb(null, result);
388 return;
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700389 }
390
Illyoung Choiab109032019-07-29 14:04:10 -0700391 // WebSocket interface for reporting workflow run status bulk
392 // Message format:
393 // {
394 // topic: 'cord.workflow.ctlsvc.workflow.report_run_status_bulk',
395 // message: {
396 // req_id: <req_id> // optional
397 // data: [{
398 // workflow_id: <workflow_id>,
399 // workflow_run_id: <workflow_run_id>,
400 // status: one of ['success', 'running', 'failed', 'unknown']
401 // }, ...]
402 // }
403 // }
404 const reportWorkflowRunStatusBulk = (topic, message, cb) => {
405 const eventrouter = require('./eventrouter.js');
406
407 let errorMessage;
408 if(!message) {
409 // error
410 errorMessage = `Message body for topic ${topic} is null or empty`;
411 logger.log('warn', `Return error - ${errorMessage}`);
412 cb(errorMessage, false);
413 return;
414 }
415
416 if(!('data' in message)) {
417 // error
418 errorMessage = `field 'data' does not exist in message body - ${JSON.stringify(message)}`;
419 logger.log('warn', `Return error - ${errorMessage}`);
420 cb(errorMessage, false);
421 return;
422 }
423
424 let results = [];
425 for(let d in message.data) {
426 if(!('workflow_id' in d)) {
427 // error
428 errorMessage = `field 'workflow_id' does not exist in message body - ${JSON.stringify(d)}`;
429 logger.log('warn', `Return error - ${errorMessage}`);
430 cb(errorMessage, false);
431 return;
432 }
433
434 if(!('workflow_run_id' in d)) {
435 // error
436 errorMessage = `field 'workflow_run_id' does not exist in message body - ${JSON.stringify(d)}`;
437 logger.log('warn', `Return error - ${errorMessage}`);
438 cb(errorMessage, false);
439 return;
440 }
441
442 if(!('status' in d)) {
443 // error
444 errorMessage = `field 'status' does not exist in message body - ${JSON.stringify(d)}`;
445 logger.log('warn', `Return error - ${errorMessage}`);
446 cb(errorMessage, false);
447 return;
448 }
449
450 let workflowRunId = d.workflow_run_id;
451 let status = d.status;
452
453 // there must be a workflow matching
454 // set workflow status
455 let result = eventrouter.setWorkflowRunStatus(workflowRunId, status);
456 results.append(result);
457 }
458
459 cb(null, results);
460 return;
461 }
462
Illyoung Choi59820ed2019-06-24 17:01:00 -0700463 const getRouter = () => {
464 return {
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700465 registerWorkflow: {
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700466 topic: serviceEvents.WORKFLOW_REGISTER,
Illyoung Choie3ce4cf2019-06-28 11:07:47 -0700467 handler: registerWorkflow
Illyoung Choi59820ed2019-06-24 17:01:00 -0700468 },
469 registerWorkflowEssence: {
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700470 topic: serviceEvents.WORKFLOW_REGISTER_ESSENCE,
Illyoung Choi59820ed2019-06-24 17:01:00 -0700471 handler: registerWorkflowEssence
472 },
473 listWorkflows: {
474 topic: serviceEvents.WORKFLOW_LIST,
475 handler: listWorkflows
476 },
477 listWorkflowRuns: {
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700478 topic: serviceEvents.WORKFLOW_LIST_RUN,
Illyoung Choi59820ed2019-06-24 17:01:00 -0700479 handler: listWorkflowRuns
480 },
481 checkWorkflow: {
482 topic: serviceEvents.WORKFLOW_CHECK,
483 handler: checkWorkflow
484 },
Illyoung Choi59820ed2019-06-24 17:01:00 -0700485 removeWorkflow: {
486 topic: serviceEvents.WORKFLOW_REMOVE,
487 handler: removeWorkflow
488 },
489 removeWorkflowRun: {
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700490 topic: serviceEvents.WORKFLOW_REMOVE_RUN,
Illyoung Choi59820ed2019-06-24 17:01:00 -0700491 handler: removeWorkflowRun
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700492 },
Illyoung Choic707c052019-07-18 13:50:49 -0700493 reportNewWorkflowRun: {
494 topic: serviceEvents.WORKFLOW_REPORT_NEW_RUN,
495 handler: reportNewWorkflowRun
496 },
Illyoung Choiab109032019-07-29 14:04:10 -0700497 reportWorkflowRunStatus: {
498 topic: serviceEvents.WORKFLOW_REPORT_RUN_STATUS,
499 handler: reportWorkflowRunStatus
500 },
501 reportWorkflowRunStatusBulk: {
502 topic: serviceEvents.WORKFLOW_REPORT_RUN_STATUS_BULK,
503 handler: reportWorkflowRunStatusBulk
Illyoung Choi59820ed2019-06-24 17:01:00 -0700504 }
505 };
506 };
507
508 // out-going commands
509 const kickstartWorkflow = (workflowId, workflowRunId) => {
510 const eventrouter = require('./eventrouter.js');
511
512 let clients = eventrouter.getWorkflowManagerClients();
513 _.forOwn(clients, (client, _clientId) => {
514 let socket = client.getSocket();
515 if(socket) {
516 socket.emit(serviceEvents.WORKFLOW_KICKSTART, {
517 workflow_id: workflowId,
518 workflow_run_id: workflowRunId
519 });
520 }
521 });
522 return;
523 };
524
Illyoung Choiab109032019-07-29 14:04:10 -0700525 const checkWorkflowRunStatus = (workflowId, workflowRunId) => {
Illyoung Choic707c052019-07-18 13:50:49 -0700526 const eventrouter = require('./eventrouter.js');
527
528 let clients = eventrouter.getWorkflowManagerClients();
529 _.forOwn(clients, (client, _clientId) => {
530 let socket = client.getSocket();
531 if(socket) {
Illyoung Choiab109032019-07-29 14:04:10 -0700532 socket.emit(serviceEvents.WORKFLOW_CHECK_STATUS, {
Illyoung Choic707c052019-07-18 13:50:49 -0700533 workflow_id: workflowId,
534 workflow_run_id: workflowRunId
535 });
536 }
537 });
538 return;
539 };
540
Illyoung Choiab109032019-07-29 14:04:10 -0700541 const checkWorkflowRunStatusBulk = (requests) => {
542 // input is an array of
543 // {
544 // workflow_id: <workflowId>,
545 // workflow_run_id: <workflowRunId>
546 // }
547 const eventrouter = require('./eventrouter.js');
548
549 let clients = eventrouter.getWorkflowManagerClients();
550 _.forOwn(clients, (client, _clientId) => {
551 let socket = client.getSocket();
552 if(socket) {
553 socket.emit(serviceEvents.WORKFLOW_CHECK_STATUS_BULK, requests);
554 }
555 });
556 return;
557 };
558
Illyoung Choi59820ed2019-06-24 17:01:00 -0700559 module.exports = {
560 serviceEvents: serviceEvents,
561 getRouter: getRouter,
Illyoung Choic707c052019-07-18 13:50:49 -0700562 kickstartWorkflow: kickstartWorkflow,
Illyoung Choiab109032019-07-29 14:04:10 -0700563 checkWorkflowRunStatus: checkWorkflowRunStatus,
564 checkWorkflowRunStatusBulk: checkWorkflowRunStatusBulk
Illyoung Choi59820ed2019-06-24 17:01:00 -0700565 };
Illyoung Choib4fc0d82019-07-16 10:29:39 -0700566})();