Dear All,
I trust this message finds you well and safe, for the past few days i tried to solve this issues but i am still receiving ActivityIsEndingException when firing the method
sendResponsePdu(esme, PduRequest, PduResponse).
Mainly i am forwarding an sms from Esme1 to Esme2.
////////////////////////////////////////////////////////////////////////////////////////////////////////
I tried to change my code and use this example where by they making use of (Asynchronous method)
and the output was something like this:
public void onSUBMIT_SM(com.cloudhopper.smpp.pdu.SubmitSm event,
ActivityContextInterface aci/* , EventContext eventContext */) {
EsmeManagement esmeManagement = EsmeManagement.getInstance();
Esme esmeGo= esmeManagement.getEsmeByClusterName("simu");
this.smppLevelSession = esmeGo.getSmppSession();
WindowFuture<Integer, PduRequest, PduResponse> future1 = this.smppLevelSession
.sendRequestPdu(event, 10000, true);
// while (!future1.isDone()) {}
if (!future1.await()) {
log.error("Failed to receive enquire_link_resp within specified time");
} else if (future1.isSuccess()) {
SubmitSmResp resp = (SubmitSmResp) future1.getResponse();
this.smppServerSessions.sendResponsePdu(inEsme, event, resp);
} else {
log.error("Failed to properly receive resp: " + future1.getCause());
}
}
With this code everything is working perfectly i am able to receive SubmitSm from Esme1 and forward to Esme2, and i am able to receive SubmitSmResponse from Esme2 and forward it to Esme1.
/////////////////////////////////////////////////////////////////////////////////////////////////////
But my supervisor told me this is not efficient because it is BLOCKING the messages and it contains timer to handle responses, which is not good. He told me to revert back to the old code and sort it out.......
/////////////////////////////////////////////////////////////////////////////////////////////////////
This is the old code which is throwing error : ActivityIsEndingException
public void onSUBMIT_SM(com.cloudhopper.smpp.pdu.SubmitSm event,
ActivityContextInterface aci/* , EventContext eventContext */) {
// Incoming Esme
SmppTransaction smppServerTransaction = (SmppTransaction) aci.getActivity();
Esme inEsme = smppServerTransaction.getEsme();
ObjectEsme objectEsme = new ObjectEsme(inEsme);
//CMP Fields for Esme
this.setObjEsme(objectEsme);
//CMP Fields for SubmitSm
ObjectSubmitSm objectSubmitSm = new ObjectSubmitSm(event);
this.setObjSubmit(objectSubmitSm);
// Response Block
SubmitSmResp submitRes = event.createResponse();
// Outgoing Esme
EsmeManagement esmeManagement = EsmeManagement.getInstance();
Esme outEsme = esmeManagement.getEsmeByClusterName("simu");
if (outEsme == null || outEsme.isClosed() || !outEsme.isBound()) {
log.info(" Message will not be forwaded: ESMEisFAILURE: " + outEsme);
submitRes.setMessageId(Byte.toString(event.getDefaultMsgId()));
submitRes.setCommandStatus(SmppConstants.STATUS_SUBMITFAIL);
this.smppServerSessions.sendResponsePdu(inEsme, event, submitRes);
return;
}
log.info(" Message will be forwaded: successfully");
SmppTransaction submitTxn = this.smppServerSessions.sendRequestPdu(outEsme, event,
outEsme.getWindowWaitTimeout());
// attach to the new activity so we get the response from event [SubmitSMResp]
ActivityContextInterface newaci = this.smppServerTransactionACIFactory
.getActivityContextInterface(submitTxn);
newaci.attach(this.sbbContext.getSbbLocalObject());
}
public void onSUBMIT_SM_RESP(com.cloudhopper.smpp.pdu.SubmitSmResp event,
ActivityContextInterface aci/* , EventContext eventContext */) {
// When i execute this code jainslee is throwing an error saying Activity already Ended on Outgoing dialog!
this.smppServerSessions.sendResponsePdu(this.getObjEsme().getEsme(), this.getObjSubmit().getSbmt(), event);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
Does anyone have a hint on how to approach this problem ?