ERROR
"
or "ABORT:ByUser
".The activity should have an Event Type for DELAY outgoing transition from the Event Wait Activity to indicate what should be done when a timeout happens. If a DELAY transition is not defined, the DELAY embedded process will be looked at next. If that does not exist either, the DELAY embedded process of the parent process instance will be invoked, and so on up to any package-level DELAY handler process. If no DELAY handler is found in the process instances chain, no transition is made (and no exception will be reported).
The attribute "Status after Timeout" specifies what status the activity should be set when a timeout situation occurs. There are 3 statuses possible:
Integer processMessage(String message)
. The only argument to the method
is the XML message (in String form) received along with the event (probably from external
systems and stored in DOCUMENT table). After this method call is complete, it will call handleCompletionCode() method
to return an activity status, dictating the status of the activity instance to be set after processing the message.
The valid statuses include:
WorkStatus.STATUS_COMPLETED
: the activity instance is set to completed
and transitions are made to next activities according to completion code
specified in the configuration, which can be overriden using setReturnCode()
.
This is probably the return value of the choice in most cases.WorkStatus.STATUS_WAITING
: the activity instance is kept as in waiting status.
No transition is made unless the completion code indicates a CORRECT or ABORT event type, in which
case it makes that transition while still waiting for events (in parallel).WorkStatus.STATUS_HOLD
: the activity instance is set to hold status.
No transition is made unless the completion code indicates a CORRECT or ABORT event type, in which
case it makes that transition. Typically you will need to specify a transition out to CORRECT, as there will be
no way to resume the activity instance without that.WorkStatus.STATUS_CANCELLED
: the activity instance is set to cancel status.
No transition is made unless the completion code indicates a CORRECT or ABORT event type, in which
case it makes that transition.processMessage(String)
does nothing if Received Message Variable is not defined and returns WorkStatus.STATUS_COMPLETED
.
If you do not have a need to override the method but would like to leave the activity in a status
other than Completed, you can configure the completion code in MDW Studio by prepending "Waiting::
", "Hold::
",
or "Cancelled::
" to regular completion code. Examples include "Hold::CORRECT
" and "Waiting::
".
Following table compares 2 different types of activities and how to set the completion code with activity status = Hold. You can replace Hold with Waiting and Cancelled if that is what you want.
Activity Name | Event Wait | Timer Wait/Manual Task/Sync/Heterogeneous |
---|---|---|
Invoke Correction Handler with activity in Hold | Completion code = Hold::CORRECT | Completion code =CORRECT and select Hold from drop down on "status after receiving event" |
Invoke CancellationHandler with activity in Hold | Completion code = Hold:ABORT | Completion code =ABORT and select Hold from drop down on "status after receiving event" |
processMessage()
will be invoked again,
which may immediately put the activity instance in a different status described above.setProcessInstanceCompletionCode()
, or by selecting certain task actions described below
in a manual task in the ERROR embedded process). The following table summarizes the impacts:
Subprocess completion code | Activity instance status is Hold | Activity instance status is Waiting,Cancelled or Failed | Activity instance status is Completed |
---|---|---|---|
null (this is default) or RESUME |
put the activity in waiting status again and process pending events if there are any, as described above. | do nothing for Waiting and Cancelled statuses. For Failed status, complete the activity instance and transition with null completion code. | do nothing |
START (corresponding to task action Retry) |
(undefined) | cancel current activity instance and restart another instance of the activity | restart another instance of the activity |
ABORT (corresponding to task action Cancel) |
(undefined) | Cancel the activity | Do nothing |
ABORT:this_process (corresponding to task action Abort) |
(undefined) | cancel the activity and terminate (complete) the parent process | terminate (complete) the parent process |
FINISH (corresponding to task action Complete) |
(undefined) | complete the activity instance, and transition accordingly (using transitions with no completion code) | transition accordingly (using transitions with no completion code) |
FINISH:compcode (corresponding to custom task action compcode) |
(undefined) | complete the activity instance, and
transition accordingly (first looking at transitions with RESUME:compcode then compcode ) |
transition accordingly (first looking at transitions with RESUME:compcode then compcode ) |
When the recurring flag is checked, it is an indication that potentially multiple events with the same name can be received. To prevent processing of an old event, MDW restricts that only one activity instance can wait for an event. This is achieved as follows: when an event wait activity registers to wait for a multiple occurrence event, the system automatically de-register other activities registered for waiting the same event (if there is any). Once the event is processed, it is marked as finished, so future registration for the same event will wait for another message.
Important note: you should never put the activity in Hold or Waiting status for a non-recurring event. This is because, for Hold status, when the CORRECT embedded process returns, it sees the non-recurring event again and invoke the CORRECT embedded process again, causing infinite loop; and for Waiting status, it sees the same event again immediately.
EventWaitActivity
(event wait), several other activities allow
to wait for unsolicited events:
The same event configuration mechanism is used to register event waits.
Additionally, you must specify the status of the activity instance to be left when
unsolicited event arrives. The default status is Hold. The following table lists allowed
statuses:
Activity | Hold | Waiting | Cancelled |
---|---|---|---|
Timer Wait | hold on timer expiration until the activity instance is resumed waiting | continue responding to timer expiration in parallel | cancel the activity |
Custom Manual Task | hold on task completion until the activity instance is resumed waiting | continue responding to task completion event in parallel | cancel the activity, as well as the task |
Invoke Multiple Subprocesses | hold on checking for all subprocess termination until the activity instance is resumed waiting | continue responding to subprocess termination in parallel | not allowed (MDW Studio does not give the option) |
Synchronization Activity | hold on checking for synchronization until the activity instance is resumed waiting | continue checking synchronization as incoming transitions arrive, in parallel | not allowed (MDW Studio does not give the option) |
TimerWaitActivity.processOtherMessage(String message)
(not processMessage()
which is for event wait). The method does not return anything, the default method does nothing.
When an embedded process returns, the same behavior as event wait activity described above applies, except when resuming waiting from a hold status, each activity behaves in its native way: