Package com.day.cq.workflow.exec
Interface WorkflowExternalProcess
-
public interface WorkflowExternalProcess
This is the interface to use to run external process steps. The external process steps are covered byWorkflowNode.TYPE_EXTERNAL_PROCESS
. They are typically used for asynchronous tasks to execute on external systems. Flow:- First the
execute(WorkItem, com.day.cq.workflow.WorkflowSession, com.day.cq.workflow.metadata.MetaDataMap)
method is called, providing an identifier for the external process - Then the
hasFinished(java.io.Serializable, WorkItem, com.day.cq.workflow.WorkflowSession, com.day.cq.workflow.metadata.MetaDataMap)
method is called periodically to check if the external process has finished. Interval and timeouts can be configured on the step - Once
hasFinished(java.io.Serializable, WorkItem, com.day.cq.workflow.WorkflowSession, com.day.cq.workflow.metadata.MetaDataMap)
returnstrue
thehandleResult(java.io.Serializable, WorkItem, com.day.cq.workflow.WorkflowSession, com.day.cq.workflow.metadata.MetaDataMap)
method is called, to read the results, if any
execute()
looks like. The engine does not make any assumptions about it, other than it must be serializable. But of course the implementations ofhasFinished()
andhandleResult()
must know about it and handle it accordingly. - First the
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.io.Serializable
execute(WorkItem item, WorkflowSession session, MetaDataMap arguments)
Executes the external process step.void
handleResult(java.io.Serializable externalProcessId, WorkItem workItem, WorkflowSession session, MetaDataMap arguments)
Get and handle the result of the external process, given by the external process id.boolean
hasFinished(java.io.Serializable externalProcessId, WorkItem item, WorkflowSession session, MetaDataMap arguments)
Tests the external process, given by the external process id, for completeness.
-
-
-
Method Detail
-
execute
java.io.Serializable execute(WorkItem item, WorkflowSession session, MetaDataMap arguments) throws WorkflowException
Executes the external process step. In order to keep track of this asynchronous process, an identifier must be returned. One can returnnull
to indicate that nothing was executed. In this case, the step directly advances to the next step.- Parameters:
item
- The current work itemsession
- The current workflow sessionarguments
- The current steps node arguments (aka as node meta data)- Returns:
- Any serializable identifier for the external process executed, or
null
- Throws:
WorkflowException
- When an error is encountered
-
hasFinished
boolean hasFinished(java.io.Serializable externalProcessId, WorkItem item, WorkflowSession session, MetaDataMap arguments)
Tests the external process, given by the external process id, for completeness.- Parameters:
externalProcessId
- The external process to test for completenessitem
- The current work itemsession
- The current workflow sessionarguments
- The current steps node arguments (aka as node meta data)- Returns:
- boolean Returns True or False if process has finished
-
handleResult
void handleResult(java.io.Serializable externalProcessId, WorkItem workItem, WorkflowSession session, MetaDataMap arguments) throws WorkflowException
Get and handle the result of the external process, given by the external process id. This would include storing any results where appropriate for further use.- Parameters:
externalProcessId
- The external process to handle the results forworkItem
- The current work itemsession
- The current workflow sessionarguments
- The current steps node arguments (aka as node meta data)- Throws:
WorkflowException
- When an error is encountered
-
-