[jpos-users] AbortParticipant related question

classic Classic list List threaded Threaded
2 messages Options
Nik
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jpos-users] AbortParticipant related question

Nik
My SendResponse Participant implements AbortParticipant interface.

Is this correct ?

   
public void abort(long l, Serializable serializable) {
 sendMessage
((Context) serializable);
 
}


private void sendMessage(Context context) {
 
ISOSource source = (ISOSource) context.get(Constants.SOURCE);
 
ISOMsg msgResp = (ISOMsg) context.get(Constants.RESPONSE);
 
try {
 source
.send(msgResp);
 
} catch (IOException e) {
 e
.printStackTrace();
 
} catch (ISOException e) {
 e
.printStackTrace();
 
}
 
}


@Override
public int prepareForAbort(long id, Serializable context) {
 sendMessage
((Context) serializable);
 
return 0;
 
}

If SendResponse Participant joined Transaction and some other Participant returned ABORT later in the assembly line, then abort method of SendResponse will be called.
If SendResponse did not join Transaction and some other Participant returned ABORT, then prepareForAbort method of SendResponse will be called. 

In both the cases, sendMessage will be called and RESPONSE will be sent back to client. 

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/6bebe6cb-82f4-423e-8c8d-9897ad9d32a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [jpos-users] AbortParticipant related question

Alejandro Revilla
SendResponse implements AbortParticipant because you typically want it to take the opportunity to join the transaction in order to provide a response back to the POS at commit time or abort time. You can of course use a flag in the Context to inhibit the response if you want to just ignore it and have the POS retry the transaction.

Without implementing AbortParticipant, SendResponse would only be able to provide replies in situations where the transactions commits (all participants return PREPARED).



--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dnd%3D12Rj8km-D69%3DBPhRamVjpfiQFBmD4xMc5%3D6p8YPBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...