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.