Real Time Information Director User Documentation
RTID Message Format and Programmatic Interfaces
Hewlett-Packard Company 16 529618 - 002
5. Invoke the dispatch method with an input stream and an output stream. For
example:
try{
int result = dispatchEjb.dispatch(message, response);
}
6. Catch any exceptions. For example:
catch(Exception e)
{
e.printStackTrace();
}
Invoking the Dispatcher Directly from a Client on the NonStop
Server
You can invoke the RTID Dispatcher directly from a Java program and use streams to
send and receive XML messages. (The Dispatcher does not absolutely require streams,
but stream processing is the most efficient option.)
1. Import the Dispatcher into your program. Also import the Java classes used for
processing streams. For example:
import com.hp.rtid.services.Dispatcher;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
2. Use the getInstance method to get an instance of the Dispatcher. For example:
dispatcher = Dispatcher.getInstance();
3. Catch any InitializationException. For example:
catch (InitializationException e){
System.out.println("Cannot initialize dispatcher
Exception: " + e);
}
4. Use the Dispatch method to send an XML file as a stream to the Dispatcher and to
receive the reply. For example:
dispatcher.dispatch(Stream inputStream, Stream outputStream);
If you simply want to load data and don’t need a reply, you can use the following
syntax: