Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using the Callback Model | General Callback Objects | Using General Callbacks
 
Using General Callbacks
The following example contains an excerpt from a sample that shows the use of the BrokerClient.registerCallback method to register a general callback object.
class subscribe2
{
. . .
static int num_to_receive = 10;
public static void main(String args[])
{
. . .
SampleCallback2 sample_callback =
new SampleCallback2(num_to_receive);
/* Create a client */
. . .
/* Check if can subscribe */
. . .
/* Register callback */
try {
c.registerCallback(sample_callback,null);
} catch (BrokerException ex) {
System.out.println("Error on registering callback\n"+ex);
return;
}
/* Open the subscription */
. . .
/* Do main loop */
try {
BrokerClient.mainLoop();
} catch (BrokerException ex) {
System.out.println("Error on dispatch\n"+ex);
return;
}
. . .