Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using the Callback Model | Dispatching Callback Methods | Using threadedCallbacks
 
Using threadedCallbacks
The BrokerClient.threadedCallbacks method will create a thread that invokes BrokerClient.mainLoop. Using this method can simplify your application code because it handles the thread creation for you. The example below contains an excerpt from a sample application that shows how to use the BrokerClient.mainLoop method.
/* Enable threaded callbacks */
try {
BrokerClient.threadedCallbacks(true);
} catch (BrokerException ex) {
System.out.println("Error on enabling threaded callbacks\n" + ex);
return;
}
Invoking threadedCallbacks( true ) is identical to creating a thread and invoking the BrokerClient.mainLoop method on that thread.
Invoking threadedCallbacks( false ) is identical to invoking the BrokerClient.stopMainLoop method.