Business components : Business components : Supporting components : Asynchronous Message : Tasks
  
Tasks
See also
Using UDTT Message
Configuring UDTT Message
Customizing UDTT Message
Asynchronous Message
Using UDTT Message
To use UDTT Message component
1 Configure UDTT Message on the server side and client side.
2 Implement MessageListener. For example:
BasicElementFactory factory = new BasicElementFactory("jar:///config/bttmsg.xml");
ListenerManager msgListenerManager = (ListenerManager) factory.getElement("msgListenerManager");
MessageDispatcher msgMessageDispatcher = (MessageDispatcher) factory.getElement("msgMessageDispatcher")
MessageListener msgListener = new MessageListener(){
  public void onMessage(Object message) {
  System.out.println("receive msg : " + message);
  }
};
3 Register MessageListener on ListenerManager. For example:
msgListenerManager.register("term01", msgListener);
4 Send message with MessageDispatcher. For example:
msgMessageDispatcher.send("term01", "message");
5 Unregister MessageListener from ListenerManager. For example:
msgListenerManager.remove("term01", msgListener);
See also
Tasks
Configuring UDTT Message
UNICOM® Digital Transformation Toolkit (UDTT™) provides HTTP implementation and JMS implementation for UDTT Message.
See also
Configuring UDTT Message with HTTP implementation
Configuring UDTT message with JMS implementation
Tasks
Configuring UDTT Message with HTTP implementation
The http implementation of UDTT 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.
Prerequisite
The http implementation of UDTT Message needs the following jars from Apache on runtime Make sure they are in the runtime CLASSPATH of your project.
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\
Procedure
1 Configure on the server side
Deploy Remote
UDTT Remote is needed when using UDTT 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 UDTT Message configuration file.
Deploy MessageDispatcher
When using HTTP implementation, com.ibm.btt.msg.poll.PollMessageDispatcher should be deployed on server side. You can do this with UDTT 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 UDTT 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 UDTT 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>
Parameters
serviceId
The ID of com.ibm.btt.msg.poll.PollMessageDispatcher on server side.
remoteConnectorUrl
The URL of the UDTT Service Connector you deployed on server side.
interval
The time between two queries, measured in ms (microsecond).
See also
Configuring UDTT Message
Configuring UDTT message with JMS implementation
The JMS implementation of UDTT Message is provided as bttmessage.jar ( an eclipse plug-in is provided also) and bttjmsmessage.jar. The two jars must be used at the same time.
Note The JMS implementation of UDTT Message needs the following jars from WebSphere Application Client on runtime.
<WAS_APP_Client>\plugins\com.ibm.ffdc.jar
<WAS_APP_Client>\plugins\com.ibm.ws.admin.core.jar
<WAS_APP_Client>\plugins\com.ibm.ws.bootstrap.jar
<WAS_APP_Client>\plugins\com.ibm.ws.emf.jar
<WAS_APP_Client>\plugins\com.ibm.ws.runtime.jar
<WAS_APP_Client>\plugins\com.ibm.ws.sib.server.jar
<WAS_APP_Client>\plugins\com.ibm.ws.sib.utils.jar
<WAS_APP_Client>\plugins\com.ibm.ws.wccm.jar
<WAS_APP_Client>\plugins\com.ibm.wsspi.extension.jar
<WAS_APP_Client>\plugins\org.eclipse.core.runtime_.jar
<WAS_APP_Client>\plugins\org.eclipse.equinox.registry.jar
<WAS_APP_Client>\plugins\org.eclipse.osgi_.jar
<WAS_APP_Client>\lib\j2ee.jar
<WAS_APP_Client>\lib\bootstrap.jar
<WAS_APP_Client>\java\jre\lib\ext\iwsorbutil.jar
You can find them at:
<WAS_APP_Client>\plugins\
<WAS_APP_Client>\lib\
<WAS_APP_Client>\java\jre\lib\ext\
Please make sure they are in the runtime CLASSPATH of your project.
See the following steps to configuring UDTT message with JMS implementation:
1 Configure on the server side. When using UDTT Message with JMS implementation, no specific UDTT configuration is needed. But UDTT Message will communicate with the JMS provider on server side, so you need configure the JMS Provider in WAS. See the following steps:
Configure the System Integration Bus in WAS.
Configure the JMS Provider in WAS.
Configure the Queue Connection Factory.
Configure the Message Queue in WAS.
2 Configure on the client side. Initialize com.ibm.btt.msg.jms.JmsMessageDispatcher and com.ibm.btt.msg.jms.JmsListenerManager on client side. You can do this with UDTT Elementfactory. See the following example:
<bttmessage.xml>
<com.ibm.btt.msg.jms.JmsMessageDispatcher id="msgMessageDispatcher" InitMethod="initialize">
<ref refId="jmsConfig" Injection="jmsConfig" />
</com.ibm.btt.msg.jms.JmsMessageDispatcher>
<com.ibm.btt.msg.jms.JmsListenerManager id="msgListenerManager" InitMethod="initialize">
<ref refId="jmsConfig" Injection="jmsConfig" />
</com.ibm.btt.msg.jms.JmsListenerManager>
<com.ibm.btt.msg.jms.JmsConfig id="jmsConfig"
initialContextFactory="com.ibm.websphere.naming.WsnInitialContextFactory"
providerUrl="iiop://localhost:2809" connectionFactory="jms/BTTQueueConnectionFactoryDF"
destination="jms/BTTSendQDF" />
</bttmessage.xml>
Parameters
com.ibm.btt.msg.jms.JmsConfig
It's a help class for JMS configuration.
initialContextFactory
It's the initial JNDI context factory of WAS.
providerUrl
It's the provider URL of the WAS JNDI.
connectionFactory
It's the jndi of the queue factory that been configured in WAS.
destination
It's the jndi of the queue you configured in WAS, UDTT Message will use the queue to store the message.
See also
Configuring UDTT Message
Customizing UDTT Message
UDTT Message provides MessageListener interface, you should implements the interface according to their business logic. See the following example:
MessageListener msgListener = new MessageListener(){
public void onMessage(Object message) {
System.out.println("receive msg : " + message);
}
};
See also
Tasks