public void connect() throws ServerDownExceptionIf a connection could not be made to the broker, a ServerDownException will be thrown. If this should happen, your application will probably either terminate or try again later.
public void callProc(String server,
String data) throws ServerDownExceptionThe parameters are the name of the server to be called, and the one line of data which identifies the method and any parameters it takes.
If the connection to the Broker has been lost, a ServerDownException will be thrown.
NOTE: There should be an equivalent method which takes an array or a Vector of Strings for multiline calls, but this has not been implemented yet. If you need this functionality, send me an e-mail and I'll implement it.
public Object callFunc(String server,
String data) throws BrokerException, ServerDownExceptionThe BrokerException is thrown if an error condition is recieved from the called method, and its message is set to the error message from the method. The ServerDownException is thrown
The reply can be either a String or a java.util.Vector of Strings (in the case of a multi-line return.) You can check which is the case by using Java's instanceof operator:
Object result;
result = brokerClient.callFunc( "Adder", "add 2 3 4" );
if( result instanceof String )
System.out.println("The result was: " + ((String) result) );
else
throw new Error("Expected a String as the result of Add, but got something else?");
© Copyright 1997 Erland
Lewin and the members of the Center
for Speech Technology