Transaction Participants

72 views
Skip to first unread message

Kavya BR

unread,
Apr 18, 2024, 9:09:52 AMApr 18
to jPOS Users
Hi All,

I had couple of questions around Transaction Participant.
1) If I have one participant as part of TransactionManager, will the instantiation of participant class happen thrice if there are 3 entries in the space? Or is it just one instantiated object that will be used for all three entries ?

2) Can transaction participant take instantiated object as input instead of class ?
In the below example, can I pass instantiated object of QueryHost instead of the org.jpos.transaction.participant.QueryHost ?? Can Transaction manager use this object instead of internally instantiating internally during the init process ?

<txnmgr class="org.jpos.transaction.TransactionManager" logger="Q2"> 
        <participant class="org.jpos.transaction.participant.QueryHost"/> 
 </txnmgr>



---
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender, delete the material from any computer and destroy all copies.

Andrés Alcarraz

unread,
Apr 18, 2024, 9:40:05 AMApr 18
to jpos-...@googlegroups.com
Hi Kavya

1) No, only one instance per each participant definition, even for N concurrent sessions, the participants are lightweight objects that do not hold any other state than its configuration, unless they have to maintain some session handling to a third party. It's the same instance used for handling all requests.

2) No, the whole lifecycle of the participants is handled by the transaction manager, so you can't instantiate it yourself. Think of it like when you configure a class in a HTTP server to handle requests. You can provide the constructor, but the server will instantiate the objects.

Hope this answers your questions.
Andrés Alcarraz
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/3a0b0bc1-f0c5-4ac6-ba37-30b1372823dbn%40googlegroups.com.

Kavya BR

unread,
Apr 23, 2024, 12:56:35 AMApr 23
to jPOS Users
2) No, the whole lifecycle of the participants is handled by the transaction manager, so you can't instantiate it yourself. Think of it like when you configure a class in a HTTP server to handle requests. You can provide the constructor, but the server will instantiate the objects.

On this one, what do you mean when you say we can provide the constructor ?? In the below example, if QueryHost has a parameterised contructor present, is there a way to tell TransactionManager to use parameterised constructor while instantiating the object ?? I see that by default transaction manager uses non parameterised constructor,


<txnmgr class="org.jpos.transaction.TransactionManager" logger="Q2"> 
        <participant class="org.jpos.transaction.participant.QueryHost"/> 
 </txnmgr>

Mark Salter

unread,
Apr 23, 2024, 1:14:21 AMApr 23
to jpos-...@googlegroups.com

The TransactionManager Participant lifecycle us very well defined and documented.  Please read the documentation.

It seems like you might have a need or requirement though.  Why not explain what you want to be able to do and ask how?

If someone here has had the same need, then they may offer a way to achieve whatever it is you want to do.

-- 
Mark

Sent from Proton Mail Android



-------- Original Message --------
signature.asc

Alejandro Revilla

unread,
Apr 24, 2024, 4:57:12 PMApr 24
to jpos-...@googlegroups.com
A no-args constructor is currently required. Related to your question, there's a very interesting pull request that adds annotations to the participants. It still doesn't address your concern, but it's kind of related and very nice. The PR is incubating. https://github.com/jpos/jPOS/pull/576



Reply all
Reply to author
Forward
0 new messages