Runtime components : Service components : Smart channel services : Smart data collector : Server collector
  
Server collector
The UDTT Smart server-side data collectors provide API to help collect the data from server-side to record visit or transaction data into database. Following is the server-side collector mechanism:
This graphic is described in the surrounding text.
Following is the general steps for the server collector:
1 Add smart data collector handler in the UDTT channel driver. In file btt.xml, configure the following smart collector handler and the configuration file path.
<kColl
id="html">
<field id="SmartCollectorHandler"
value="com.ibm.btt.poc.util.SmartChannelDataCollectorPoC"/>
<field id="smartCollectorConfigFile"
value="jar:///bcConfig/SmartCollect.xml"/>
</kColl>
The SmartCollectorHandlerfield is the class of the smart collector handler. It should extend class com.ibm.btt.channel.AbstractSmartCollector and implement the processResult (Map<String> result) method. This method process the parameter result, and then return the Boolean value according to user-defined logic. If the method return true, it performs the smart collecting; else if it return false, it will not collect the data. The smartCollectorConfigFilefield is the smart collector configuration file path.
2 When server starts, it initiates smart data handler policy rule by element factory. The configured smartCollectorConfigFile file contains the global configuration: sampling rule, the global DAO pattern: JMS or general smart DAO. It also defines the server-side smart collector transactions, transaction collector sampling rule, transaction-related dynamic request data extension. Following is the sample code:
<SmartChannelDataCollect.xml>
<props id="classTable">
<entry key="SmartCollectorConfig4Transaction"
value="com.ibm.btt.channel.SmartCollectorConfig4Transaction"></entry>
<entry key="SmartCollectorConfig"
value="com.ibm.btt.channel.SmartCollectorConfig"></entry>
<entry key="SmartDataCollectJMSImpl"
value="com.ibm.btt.channel.smart.dao.jms.SmartDataCollectJMSImpl"></entry>
<entry key="SmartDataCollectDefaultImpl"
value="com.ibm.btt.channel.smart.dao.jpa.SmartDataCollectDAOImpl"></entry>
</props>
<SmartDataCollectJMSImpl id="jmsDAOImpl"
jmsConnectionFactory="jms/SmartChannelCF" jmsSendQueue="jms/SmartQueue">
</SmartDataCollectJMSImpl>
<SmartDataCollectDefaultImpl id="smartDAOImpl"> </SmartDataCollectDefaultImpl>

<SmartCollectorConfig id="smartCollectorConfig"
sampleRateRuleServiceName="globalDataCollectorRuleService"
smartDAO="smartDAOImpl">
<ref Injection="transactionCollectorConfig"
refId="TransactionDataCollectorConfig"/>
</SmartCollectorConfig>
<java.util.ArrayList id="TransactionDataCollectorConfig">
<SmartCollectorConfig4Transaction transactionID="accountTransferOp"
sampleRateRuleServiceName="transferDataCollectorRuleService"
extendBean="com.ibm.btt.poc.transfer.AccountTransferBehavior"
actionType="behavior">
<map Injection="dataMap">
<entry key="acctFrom" value="accountNumber"></entry>
<entry key="amount" value="amount"></entry>
</map>
</SmartCollectorConfig4Transaction>
</java.util.ArrayList>
</SmartChannelDataCollect.xml>
The service class should extend the class com.ibm.btt.channel.ruleprovider.java.JavaCodeRuleProviderService, which is included in the bttruleprovider.jar. The actionType should be behavioror visit. Other value is not accepted. The extendBeanshould be predefined. If the actionType is behavior, the class should extend the class com.ibm.btt.channel.smart.data.BehaviorLog. If the actionType is visit, the class should extend the class com.ibm.btt.channel.smart.data.VisitLog.
3 The operation name or processor id are used as transactionID, when the request comes, it gets the operation name or processor id to match. If it matches the transactionID, it performs the smart collecting according to the rule.
4 Smart data handler policy support global rule and transaction rule, the customers can add their owner business logic in it. If the transaction rule is configured, it collects according to transaction rule; if the transaction rule is not configured, it checks the global rule; The collector performs collecting even if the transaction rule and global rule are neither configured.
See
Smart visit server collector
Smart behavior server collector
Sampling for the server collector
Dynamic extension data map for the server collector
Go up to
Smart data collector