37 |
37 |
|
38 |
38 |
private static final Log log = LogFactory.getLog(WorkflowDispatcher.class);
|
39 |
39 |
|
40 |
|
public String dispatchMetaWorkFlow(final String metaWfId) throws ManagerServiceException {
|
|
40 |
public void dispatchMetaWorkFlow(final String metaWfId) throws ManagerServiceException {
|
41 |
41 |
try {
|
42 |
42 |
final MetaWorkflow metaWf = isClient.getResourceByCode(metaWfId, MetaWorkflow.class);
|
43 |
43 |
final WorkflowInstance wfi = metaWf.getRootWorkflowInstance();
|
44 |
|
return dispatchWorkFlow(metaWf, wfi.getWfName(), DEFAULT_PRIORITY);
|
|
44 |
dispatchWorkFlow(metaWf, wfi.getWfName(), DEFAULT_PRIORITY);
|
45 |
45 |
} catch (Throwable e) {
|
46 |
46 |
log.error("Error dispatching wf", e);
|
47 |
47 |
throw new ManagerServiceException("Error dispatching wf", e);
|
48 |
48 |
}
|
49 |
49 |
}
|
50 |
50 |
|
51 |
|
public String dispatchWorkFlow(final String metaWfId, final String wfName) throws ManagerServiceException {
|
|
51 |
public void dispatchWorkFlow(final String metaWfId, final String wfName) throws ManagerServiceException {
|
52 |
52 |
try {
|
53 |
53 |
final MetaWorkflow metaWf = isClient.getResourceByCode(metaWfId, MetaWorkflow.class);
|
54 |
|
return dispatchWorkFlow(metaWf, wfName, DEFAULT_PRIORITY);
|
|
54 |
dispatchWorkFlow(metaWf, wfName, DEFAULT_PRIORITY);
|
55 |
55 |
} catch (Throwable e) {
|
56 |
56 |
log.error("Error dispatching wf", e);
|
57 |
57 |
throw new ManagerServiceException("Error dispatching wf", e);
|
58 |
58 |
}
|
59 |
59 |
}
|
60 |
60 |
|
61 |
|
public String dispatchWorkFlow(final MetaWorkflow metaWf, final String wfName,
|
|
61 |
public void dispatchWorkFlow(final MetaWorkflow metaWf, final String wfName,
|
62 |
62 |
final int priority) throws ManagerServiceException {
|
|
63 |
final WorkflowInstance wfi = metaWf.findWorkflowInstanceByName(wfName);
|
|
64 |
dispatchWorkFlow(metaWf, wfi, priority);
|
|
65 |
}
|
|
66 |
|
|
67 |
private void dispatchWorkFlow(final MetaWorkflow metaWf, final WorkflowInstance wfi, final int priority) throws ManagerServiceException {
|
63 |
68 |
try {
|
64 |
|
final WorkflowInstance wfi = metaWf.findWorkflowInstanceByName(wfName);
|
|
69 |
final String wfName = wfi.getWfName();
|
65 |
70 |
|
66 |
71 |
final String xml = isClient.getXmlResourceByCode(wfi.getWfCode(), Workflow.class);
|
67 |
72 |
|
... | ... | |
93 |
98 |
info.setLastActivityDate(now);
|
94 |
99 |
updateMetaWf(metaWf.getCode(), wfName, LastExecutionStatus.SUCCESS, now);
|
95 |
100 |
System.out.println("***** SUCCESS: " + m.getProcId() + " - " + m.getCurrentNode());
|
|
101 |
|
|
102 |
for (WorkflowInstance nextWfi : wfi.getChildren()) {
|
|
103 |
try {
|
|
104 |
dispatchWorkFlow(metaWf, nextWfi, priority);
|
|
105 |
} catch (ManagerServiceException e) {
|
|
106 |
log.error("Child Workflow not launched", e);
|
|
107 |
}
|
|
108 |
}
|
96 |
109 |
}
|
97 |
110 |
|
98 |
111 |
@Override
|
... | ... | |
116 |
129 |
});
|
117 |
130 |
info.setWorkerId(workerId);
|
118 |
131 |
|
119 |
|
return info.getProcId();
|
|
132 |
// return info.getProcId();
|
120 |
133 |
} catch (Throwable e) {
|
121 |
134 |
log.error("Error dispatching wf", e);
|
122 |
135 |
throw new ManagerServiceException("Error dispatching wf", e);
|
wf dependencies