Configuring BTT Message with HTTP implementation

About this task

The http implementation of BTT Message is provided as bttmessage.jar and an eclipse plug-in com.ibm.btt.message.0.

You can use the bttmessage.jar in server side and use the plug-in in client side.

Note that the http implementation of BTT Message needs the following jars from Apache on runtime:
  • commons-codec-1.3.jar
  • commons-httpclient-3.1.jar
  • commons-logging-1.1.1.jar
  • commons-logging-api-1.1.1.jar

You can find them at: <BTTInstallationPath>\plugins\com.ibm.btt.remote.0\lib\

Please make sure they are in the runtime CLASSPATH of your project.

See the following steps to configure BTT Message with HTTP implementation

Procedure

  1. Configure on the server side
    1. Deploy Remote

      BTT Remote is needed when using BTT Message with HTTP implementation. So you need to deploy com.ibm.btt.webapp.BTTServerStarter and com.ibm.btt.remote.BTTRemoteConnector to your server. See the following example:

      <context-param>
        <description></description>
        <param-name>elementFactoryConfigPath</param-name>
        <param-value>jar://config/bttmessage.xml</param-value>
      </context-param>
      
      <listener>
        <description></description>
        <display-name>BTTServerStarter</display-name>
        <listener-class>com.ibm.btt.webapp.BTTServerStarter</listener-class>
      </listener>
      
      <servlet>
        <description></description>
        <display-name>BTTRemoteConnector</display-name>
        <servlet-name>BTTRemoteConnector</servlet-name>
        <servlet-class>com.ibm.btt.remote.BTTRemoteConnector</servlet-class>
      </servlet>
      
      <servlet-mapping>
        <servlet-name>BTTRemoteConnector</servlet-name>
        <url-pattern>/BTTRemoteConnector</url-pattern>
      </servlet-mapping>

      The jar:///config/bttmessage.xml should be replaced by your own BTT Message configuration file.

    2. Deploy MessageDispatcher
      When using HTTP implementation, com.ibm.btt.msg.poll.PollMessageDispatcher should be deployed on server side. You can do this with BTT Elementfactory, see the following example:
      <bttmessage.xml>
        <com.ibm.btt.msg.poll.PollMessageDispatcher  id="com.ibm.btt.msg.MessageDispatcher" traceMessage="true" />
      </bttmessage.xml>
  2. Configure on the client side

    To use BTT Message, you need to initialize com.ibm.btt.msg.MessageDispatcher and com.ibm.btt.msg.poll.PollListenerManager on client side. You can initialize them with BTT Elementfactory. The configuration file should like the following

    <bttmessage.xml>
      <com.ibm.btt.msg.MessageDispatcher id="msgMessageDispatcher" Instantiate="factoryElement"
        FactoryClass="com.ibm.btt.remote.RemoteProxyFactory"
        serviceId="com.ibm.btt.msg.MessageDispatcher"
        remoteConnectorUrl="http://localhost:9080/BCMessageWeb/BTTRemoteConnector">
        <ref Injection="httpClient" refId="httpClient"/>
      </com.ibm.btt.msg.MessageDispatcher>
      <com.ibm.btt.msg.poll.PollListenerManager id="msgListenerManager"
        interval="1000" InitMethod="initialize"
        remoteConnectorUrl="http://localhost:9080/BCMessageWeb/BTTRemoteConnector">
        <ref Injection="httpClient" refId="httpClient"/>
      </com.ibm.btt.msg.poll.PollListenerManager>
    </bttmessage.xml>
    Table 1.
    Parameter Description
    serviceId It's the ID of com.ibm.btt.msg.poll.PollMessageDispatcher on server side
    remoteConnectorUrl It's the URL of the BTT Service Connector you deployed on server side.
    interval It's the time between two queries, it is measured in ms (microsecond).