How to use the new HTTP MTP with JADE


Jose A. Exposito
Joan Ametller (jametller@ccd.uab.es)
Sergi Robles (srobles@ccd.uab.es)
October 20th 2003

Updated: November 20th 2003 (Nicolas Lhuillier, Motorola)

0. Index

1. Introduction
2. Building and Installing
3. Configuration

1. Introduction

This new implementation of the HTTP MTP tries to cover the lacks of the old implementation providing a robust, lightweight, efficient, and easily-configurable HTTP MTP.

The new implementation has several new features and fixes with respect to the old one. In this introduction we will explain which are these features and how can they help to agents' programmers.

1.1 Simple Implementation

This new implementation is composed of only 7 classes in front of the ~60 of the previous one.

1.2 Catching Errors

When the MTP produces an error during its execution, it should generate an MTPException. From the agents point of view this exception is translated into a FAILURE ACL message sent back to the agent.

The old implementation did not throw all the errors. An example was when an agent sent messages to a platform that was not on-line. The HTTP MTP produced an SocketException which was not transmitted to the platform. The result was that agents didn't have a mechanism to decide if the message was received or not.

In the new implementation all failure cases are transmitted. This opens the possibility of building more robust and fault-tolerant applications using this new MTP.

1.3 Performance Improving: Persistent connections

One of the drawbacks of using HTTP MTP instead of the IIOP MTP (not only in JADE, also in other platforms) was the low performance of the first one. One of the main reasons of this difference is caused because IIOP uses persistent connections. HTTP MTP usually starts a TCP connection for each message coming from one platform to another. Instead of doing the TCP handshaking protocol for every message, connections could be reused with the platforms which we communicate so often. This new feature improves very much the performance of this MTP.

This new version of the HTTP MTP can keep some connections to other platforms alive. The use of this mechanism improves a lot the timmings of inter-platform message sending, and it is totally compatible with FIPA-compliant platforms that do not implement it.

We can choose to use keep-alive or close connections from the configuration. If we choose to use keep-alive connections but the platform, which we want to communicate with does not support it, the behaviour of the HTTP MTP will be like if using a close connection with this platform.

1.4 Using HTTP MTP in restricted environments: HTTP Proxies

Also two experimental features has been included in this version. Those are the possibility of using HTTP Proxies and choose the outgoing port.

As we use an HTTP protocol we can exploit the possibilities of this protocol to cross restricted networks. The first of this features is the possibility of using an HTTP Proxy instead of sending the messages directly to the remote platform. This feature will not affect the FIPA compatibility of this protocol, and if the proxy is properly configured, the keep-alive mechanism can also work.

The second feature is the possibility of choosing the local outgoing port for platform connections.

This two issues can be useful in some corporative environments where network access is usually restricted.

1.5 Easy Configuration

This version of the HTTP MTP only works with the versions of JADE >= 3. In this versions a mechanism is included in order to use the typical configuration files of JADE to include parameters for the MTP. The effect is that the parameters of the MTP are not hardcoded to the distribution and we do not need to recompile the MTP every time we want to change them.

2. Building and Installing

2.1 Building

The distribution must be unziped within the jade folder. It will add an http-mtp to your add-ons directory. Inside it, exists a "build.xml" Ant file, so using Jakarta Ant we only need to run ant with no target to compile the sources and run "ant lib" to create the "http.jar" file that will be located in dist folder.

If JDK 1.3 is used with target "ant pjava", this creates a pjava version of this MTP (http-pjava.jar). Note that this version requires a SAX parser (see section 3) and requires the LEAP add-on to be present and "JadeLeap.jar" for pjava created.

2.2 Installing

To use the HTTP MTP we can choose to specify it from the command line:

java jade.Boot -mtp jade.mtp.http.MessageTransportProtocol

or install it from the RMA's graphical environment. Obiously, the http.jar containing the MTP class files must be in the classpath.

3. Configuration

As we said in previous sections, the new version of JADE allows to pass configuration parameters to the MTP via the JADE Configuration file. So, when we execute jade with a configuration file:

e.g. java jade.Boot -conf jade.conf

or directly from the command line:

e.g. java jade.Boot -jade_http_mtp_numKeepAlive 5

We can include some parameters that are exclusive of this MTP and that can help its tuning. If we do not specify this parameters in the configuration file, default values are taken.

jade_http_mtp_numKeepAlive=n

This parameter allows you to limit the maximum number of persistent connections that the mtp is allowed to keep. Default value for this parameter is 10. 0 means keep alive connections are not used.

jade_http_mtp_outPort=n

We can set the local port open by sockets setting up this parameter. If this parameter is not specified, a random port will be used.

jade_http_mtp_proxyHost=hostName
jade_http_mtp_proxyPort=portNumber

Setting up these parameters we can use a HTTP Proxy to redirect the platform outgoing messages. If these parameters are not specified, then connections will be opened directly to the remote platforms.

jade_http_mtp_parser=saxClassName

The HTTP MTP needs a SAX XML Parser. We can choose the SAX implementation of the parser by indicating a classname (which must be in the classpath). Since by default this MTP uses J2SE v1.4 default parser, this option is mandatory with JDK 1.3 or earlier.

jade_http_mtp_timeout=milliseconds

The Server part of the HTTP MTP keeps also connections from other platforms that are using the keep-alive feature. By setting up this timeout we can set a maximum idle time for this connections in order to improve the memory consumption. Default value for this parameter is 60000 (1 minute). If we want this time to be infinite we must put this value to 0.


JADE is a trademark of CSELT. JADE has been developed jointly by CSELT and the Computer Engineering Group of the University of Parma.
The HTTP implementation was developed in the Combinatorics and Communications Unit at the Universitat Autònoma of Barcelona by Jose Antonio Exposito with the collaboration of Nicolas Lhuillier from Motorola