The TransactionManager’s participants provide easy ways to control per transaction timeouts. One can add a
TIMESTAMP entry at the beginning of the transaction, and then have each participant control how it’s going, so to speak. If the transaction has spent more than a threshold amount of time, it’s better to abort the transaction right away because the client (i.e. POS device) probably has expired the transaction already and it’s not waiting for our response anymore.
We can do that on each participant, or you can have a general-purpose timeout participant that you can place here and there.
But because this is a common use case, to encourage its use, in jPOS Next the TransactionManager honors a couple of new attributes at the participant level:
In this example, three things can happen:
- if, by the time the TM reaches the
CreateTranLogparticipant, the transaction has taken more than 5000ms thus far, the participant is not called, and the transaction continues with the ABORTED route.
- If the partitipant takes more than 1000ms to process, even if it has returned
PREPARED, we coerce the response to
- If max time, at the end of the participant is greater than 5000ms, we also coerce the response to