Re: Transactions on Tool Activities
Sasa Bojanic <[email protected]> Wed, 13 Dec 2006 09:51:37 +0100
| Newsgroups | gmane.comp.java.enhydra.shark |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format...
------------=_1165999754-3131-17
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Hi,
shark works just like you expect. When you call complete() on Manual=20
activity, manual activity will be finished and it will execute any=20
subsequent Tool activities in the same method call.
In your case, you create and begin user transaction before completing=20
activity A, and you are committing transaction after you call complete()=20
method for this activity. During complete() method call, activity A will=20
be brought to state closed.completed, activity B will be created and=20
started and three tool agents for this activity will be executed,=20
activity B will be finished and brought to state closed.completed, and=20
since there is nothing to do in the process, process will finish and=20
will come to state closed.completed.
If anything goes wrong during any of these steps, it will be like=20
nothing happened (like you never called complete on activity A).
Look at shark as to the process state engine, and the states of the=20
process are represented by the manual activities. Automatic activities=20
are executed using the same UserTransaction your client application=20
creates before completing manual activity.
In the following scenario:
Start -> A (manual) -> B (tool) -> C (tool) -> D (manual) -> Finish
when you say something like:
// UserTransaction ut;
// WfActivity actA;
try {
ut=3DgetUserTransaction();
ut.begin();
actA.complete();
ut.commit();
} catch (Exception ex) {
try {
ut.rollback();
} catch (Exception _) {}
}
activity A is completed, activity B is created, its tool agent is=20
executed and it is completed, activity C is created, its tool agent is=20
executed and it is completed, and finally activity D is created (and=20
also assignments for activity D are created).
Greetings,
Sasa.
[email protected] wrote:
> Hi all,
>
> I understand that for all handling I do on activities and processes I =
must manually create the UserTransaction and call the begin() and commit(),=
and that's OK. However, what is the behavior for tool activities with auto=
matic start and automatic end? Imagine the following scenario:
>
> Start -> Activity A (no implementation) -> Activity B (three mapped too=
ls in a row) -> Finish
>
> Suppose that Activity A has manual start and manual end. Suppose that t=
he user (through some Shark client application) starts and completes the Ac=
tivity A, calling the transaction.begin() just before doing it and calling =
the transaction.commit() just after doing that. I suppose now that Shark en=
gine is going to invoke the three tool activities, right? However, who's go=
ing to create the user transaction, call the begin() just before invoking t=
he tools and call the commit() just after that? I mean, these must be done =
or else the start/completion of Activity B will not be performed on the Sha=
rk engine database, right?
> Also, if it is done somewhere, can you ensure me that the begin() is ca=
lled before invoking the first tool, and that the commit() is called just a=
fter invoking successfully the third tool?
> Finally, is there any means to use the Shark engine-created transaction=
for the tool activity on the invoked tools? I mean, these tools will be ma=
pping applications which are in fact Java fa=E7ades to database operations,=
and I would like to only "complete" the tool activity only if these three =
operations are successful, and vice-versa, only to commit the results of th=
e three operations if the Shark engine DB is successfully updated.
>
> Thanks in advance!
>
> Regards,
>
> Fuad Abinader
>
>=20=20=20
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [email protected] maili=
ng list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=3Dhelp
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>=20=20=20
------------=_1165999754-3131-17
Content-Type: text/plain; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: 8bit
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
------------=_1165999754-3131-17--