Operation execution task is implemented by Java thread from thread. One independent task/thread is for one execution. After the operation is executed over or exception is thrown during the operation, the Response Handler will be called to send reply SMS message.
<Op_Account_Transfer> <operation context="accountTransferCtx" id="accountTransferOp" implClass="com.ibm.btt.test.TransferOperation"></operation> <context id="accountTransferCtx" type="op"> <refKColl refId="TransferData"/> </context> <kColl id="TransferData"> <field id="custid"/> <field id="sourceAccount"/> <field id="nickName"/> <field id="amount"/> <field id="amountLimit"/> </kColl> </Op_Account_Transfer>
package com.ibm.btt.test; import com.ibm.btt.base.BTTServerOperation; import com.ibm.btt.channel.sms.SMSHandlerConstant; @SuppressWarnings("serial") public class TransferOperation extends BTTServerOperation { public void execute() throws Exception { try { Thread.sleep(200); } catch (Exception e) { e.printStackTrace(); } super.execute(); System.out.println("====== TransferOp Start =====with context: \n"+getContext().getKeyedCollection()); if (getValueAt(SMSHandlerConstant.REPLYMSG)==""||getValueAt(SMSHandlerConstant.REPLYMSG)==null) setValueAt(SMSHandlerConstant.REPLYMSG, " ====Transfer Successfully. ====\n Recipient:" +getContext().getValueAt("nickName")+"\n Amount:"+getContext().getValueAt("amount") +"\n Balance: 9201.20"); } }