Runtime components : Service components : Smart channel services : Smart data collector : JMS
  
JMS
The UDTT smart data collector supports a default JMS handler to collect smart data, which can help buffer the request for collecting the data to avoid the potential performance bottleneck. User also can implement the JMS by MQ. You can configure the JMS collecting pattern in client side and server side.
See also
JMS handler in server side
JMS handler in client side
Smart data collector
JMS handler in server side
Prerequisite: To collect the data by JMS pattern in the client side, perform the following steps:
1 Refer to the general steps in Server collector, and configure the JMS collecting pattern using the following codes:
<SmartDataCollectJMSImpl id="jmsDAOImpl" jmsConnectionFactory="jms/SmartChannelCF" jmsSendQueue="jms/SmartQueue"></SmartDataCollectJMSImpl>
<SmartDataCollectDefaultImpl
id="smartDAOImpl"> </SmartDataCollectDefaultImpl>
<SmartCollectorConfig id="smartCollectorConfig" smartDAO="jmsDAOImpl ">
<ref Injection="transactionCollectorConfig"
refId="TransactionDataCollectorConfig"></ref>
</SmartCollectorConfig>
The smartDAO should be set as smartDAOImpl or jmsDAOImpl. If it's set as jmsDAOImpl, it uses the JMS collecting pattern.
2 Create an MDBEJB project named SmartChannelJMSHandlerEJB and create a Bean implementation class for Enterprise Bean. Following is the sample code for the Bean class SmartDataJMSHandlerMDB:
package com.ibm.btt.channel.smart.dao.jms;
import com.ibm.btt.channel.smart.jmshandler.SmartJMSHandler;
/**
* Bean implementation class for Enterprise Bean: SmartDataJMSHandlerMDB
*/
public class SmartDataJMSHandlerMDBBean extends SmartJMSHandler implements javax.ejb.MessageDrivenBean,javax.jms.MessageListener{
/**
* ejbRemove
*/
public void ejbRemove() {
}
/**
* ejbCreate
*/
public void ejbCreate() {
}
private javax.ejb.MessageDrivenContext fMessageDrivenCtx;

/**
* getMessageDrivenContext
*/
public javax.ejb.MessageDrivenContext getMessageDrivenContext() {
return fMessageDrivenCtx;
}
/**
* setMessageDrivenContext
*/
public void setMessageDrivenContext(javax.ejb.MessageDrivenContext ctx) {
fMessageDrivenCtx = ctx;
}
}
Configure the file ibm-ejb-jar-bnd.xml as following codes:
<ejbbnd:EJBJarBinding
xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ejb="ejb.xmi"
xmlns:ejbbnd="ejbbnd.xmi" xmi:id="EJBJarBinding_1260934833875">
<ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
<ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding"
xmi:id="MessageDrivenBeanBinding_1260934833875"activationSpecJndiName="jms/SmartActSpec" destinationJndiName="jms/SmartQueue"> <enterpriseBean xmi:type="ejb:MessageDriven"
href="META-INF/ejb-jar.xml#SmartDataJMSHandlerMDB"/>
</ejbBindings>
</ejbbnd:EJBJarBinding>
3 Configure the JMS in WebSphere admin console as following configuration:
<SmartDataCollectJMSImpl id="jmsDAOImpl" jmsConnectionFactory="jms/SmartChannelCF" jmsSendQueue="jms/SmartQueue">
Create a connection factory: JNDI name:jms/SmartChannelCF(should be the same with the jmsConnectionFactory field that set in the smart configuration file. In this case, the file is SmartChannelDataCollect.xml);
Create a queue: JNDI name:jms/SmartQueue (should be the same with the jmsSendQueue field that set in the smart configuration file. In this case, the file is SmartChannelDataCollect.xml);
Create an activation specification: JNDI name:jms/SmartActSpec (should be the same with the activationSpecJndiName field that set in the MDB EJB project ibm-ejb-jar-bnd.xml).
See also
JMS
JMS handler in client side
The UDTT smart data collector supports a default JMS handler to collect smart data, which can help buffer the request for collecting the data to avoid the potential performance bottleneck. User also can implement the JMS by MQ. You can configure the JMS collecting pattern in client side and server side.
1 To collect the data by JMS pattern in the client side, you need to create the MDBEJB project and configure the JMS in WebSphere admin console. Refer to the step 2 and step 3 in JMS handler in server side.
2 Then copy the jmsClinetCollector.jsp data from the client/collector directory of bttweb2collector into the web directory of the web project. Integrate the jmsClinetCollector.jsp into the web page which is configured to collect the data. Add the initialization code in the script:”initJmsEnv()”. Following is the sample code:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.ibm.btt.channel.smart.SmartDataCollectUtil" %>
<%@ page import="com.ibm.btt.http.WebChannelContext" %>
<jsp:useBean id="utb" scope="page"
class="com.ibm.btt.cs.html.DSEJspContextServices">
<% utb.initialize(request); %>
</jsp:useBean><% String userId=(String)utb.getContext().getValueAt("userId"); %>
<head><jsp:include page="jmsClientCollector.jsp" flush="true"/><script type="text/javascript">
initJmsEnv(); saveVisitData("<%=userId%>");
</script>
</head>
See also
JMS