Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using the Callback Model | Dispatching Callback Methods | Using dispatch
 
Using dispatch
The BrokerClient.dispatch method can be used to wait to receive a single event for any Broker client, dispatch the event to the appropriate callback object's event handling method, and then return. The example below contains an excerpt from a sample application that shows how to use the BrokerClient.dispatch method.
/* Do dispatch loop */
count = 1;
while (count <= num_to_receive) {
try {
BrokerClient.dispatch(-1);
} catch (BrokerException ex) {
System.out.println("Error on dispatch\n" + ex);
return;
}
++count;
}