@PermitAll public abstract class AbstractAsynchronousExecutionTask extends Object implements AsynchronousExecutionTask
collectDataForExecution(TaskContext)
) and then the message is sent to
queue. Upon message retrieval, ProcessAgentMDB
will invoke method processDataAsynchronously(java.io.Serializable)
.
Since this invocation is done outside of model instance execution, this doesn't block transaction or model instance
execution or any other process-related resources. After the execution finish, the resulting data are sent back to
task, so that the task can process it in the model instance context (processExecutionResult(com.whitestein.lsps.engine.lang.TaskContext, java.io.Serializable)
). Since sometimes
can be useful to execute task synchronously or asynchronously based on task context (metadata, parameters etc.), this task
also defines method executeAsynchronously(TaskContext)
which determines if the execution is performed
directly in model instance context or asynchronously.ExecutableTask.Result
Constructor and Description |
---|
AbstractAsynchronousExecutionTask() |
Modifier and Type | Method and Description |
---|---|
abstract Serializable |
collectDataForExecution(TaskContext context)
Collects data from task context for asynchronous execution.
|
abstract boolean |
executeAsynchronously(TaskContext context)
Determines, based on current task context (params, metadata, etc.) if the exeuction
should be done asynchronously.
|
abstract Class<? extends AbstractAsynchronousExecutionTask> |
getImplementationClass() |
abstract Serializable |
processDataAsynchronously(Serializable data)
Process data collected in
AsynchronousExecutionTask.collectDataForExecution(com.whitestein.lsps.engine.lang.TaskContext) . |
abstract void |
processExecutionResult(TaskContext context,
Serializable result)
This method is called after the asynchronous execution has been done
|
ExecutableTask.Result |
processInput(TaskContext context,
Object input)
The method for processing the model instance input.
|
ExecutableTask.Result |
start(TaskContext context)
An initial method that is called when the task execution starts.
|
void |
terminate(TaskContext context,
TerminationReason reason)
Called when this task is to be terminated.
|
public ExecutableTask.Result start(TaskContext context) throws ErrorException
ExecutableTask
start
in interface ExecutableTask
null
ErrorException
- the BPMN errorpublic abstract Class<? extends AbstractAsynchronousExecutionTask> getImplementationClass()
ComponentService
.public ExecutableTask.Result processInput(TaskContext context, Object input) throws ErrorException
ExecutableTask
This method is invoked when a previous call to either
start
method or
processInput
method returned
WAITING_FOR_INPUT
and a new input is to
be process by the model instance.
processInput
in interface ExecutableTask
null
ErrorException
- the BPMN errorpublic void terminate(TaskContext context, TerminationReason reason)
ExecutableTask
terminate
in interface ExecutableTask
ErrorException
public abstract Serializable collectDataForExecution(TaskContext context) throws ErrorException
AsynchronousExecutionTask
AsynchronousExecutionTask.processDataAsynchronously(java.io.Serializable)
method asynchronously.collectDataForExecution
in interface AsynchronousExecutionTask
ErrorException
public abstract void processExecutionResult(TaskContext context, Serializable result) throws ErrorException
AsynchronousExecutionTask
processExecutionResult
in interface AsynchronousExecutionTask
result
- result of asynchronous call of method AsynchronousExecutionTask.processDataAsynchronously(java.io.Serializable)
ErrorException
public abstract Serializable processDataAsynchronously(Serializable data)
AsynchronousExecutionTask
AsynchronousExecutionTask.collectDataForExecution(com.whitestein.lsps.engine.lang.TaskContext)
. This execution is done asynchronously
outside of process model. The result of this execution is afterwards sent back to task (AsynchronousExecutionTask.processExecutionResult(com.whitestein.lsps.engine.lang.TaskContext, java.io.Serializable)
)
so that the computed results can be processed and any necessary changes in model instance can be done.
This method should not throw ErrorException
since it is not executed in model instance context.processDataAsynchronously
in interface AsynchronousExecutionTask
data
- data to processpublic abstract boolean executeAsynchronously(TaskContext context) throws ErrorException
AsynchronousExecutionTask
AsynchronousExecutionTask.processDataAsynchronously(java.io.Serializable)
will be
executed outside model instance (thus not blocking transaction, model execution, etc.}. If
false it will be called directly.executeAsynchronously
in interface AsynchronousExecutionTask
ErrorException
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.