Here we go...
I'd like to show you an example of BPEL (read BEEPLE :) that allows to implement some kind of a lifetime management using web-services.
This implementation is based on BPEL's Pick
activity, and right before we start I'd like to introduce readers in what this activity is need for. Those who familiar with that may freely skip this part.
So, as I already said, BPEL have the Pick
activity that is like widely known Switch/Case
language construction in programming languages (Java, C++ or Pascal Case/Of
). Those constructions have a possibility of redirecting control flow based on some expression, for instance (Java):
switch (directionExpression) {In BPEL the
case LEFT:
moveLeft();
break;
case RIGHT:
moveRight();
break;
case UP:
moveUp();
break;
case DOWN:
moveDown();
break;
default: // Hold
}
Pick
activity is the analog of the Switch
statement. Pick
's OnMessage
statements are like Switch
's case
statements.To be true to the reader I'd like to say that BPEL have the
Switch
activity too. The main thing that distinguish Pick
from Switch
constructions is that Pick
is a blocking activity, that means that the expression that manages the process control flow is a message that BPEL process instance is waiting for to receive, and the flow would be frozen until this message arrives, while in Switch
we already have this expression defined as a process variable and the alternative flow may be picked up without any delay.Now I'd like you to mention the
default
statement. Pick
has the analog of this statement that corresponds the situation when no message were arrived to the Pick
activity during some time period (or by deadline) - the timeout; and the activity that is responsible to handle such timeouts is Pick
's OnAlarm
.So the BPEL code using
Pick
may looks like:<pick>
<onMessage operation="approve">
<!-- TODO Implement OnApprove -->
</onMessage>
<onMessage operation="reject">
<!-- TODO Implement OnReject -->
</onMessage>
<!-- Timeout will occur in one minute -->
<onAlarm for=""PT1M"">
<!-- TODO Implement OnTimeout -->
</onAlarm>
</pick>
to be continued...
References
- The BPEL specification - Business Process Execution Language for Web Services Version 1.1 (PDF, 507K)
0 комментария(ев):
Post a Comment