Runtime components : Channels components : SMS handler : Request handler : Operation execution
  
Operation execution
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.
The operation definition and implementation are complying with UDTT operation. To map the data from SMS message content to operation context, the operation context should contains all the data fields as in SMS Command definition. Following is an example for operation definition:
<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>
To set the reply message for SMS request, the operation implementation should set the reply message in an operation context data filed name SMSConstant.REPLYMSG. Following is an example for operation definition and implementation:
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"); }
}
Go up to
Request handler