Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client C API Programmer's Guide | Using the Callback Model | General Callback Functions | Using General Callbacks
 
Using General Callbacks
The example below illustrates the use of the awRegisterCallback function to register a general callback function.
The following example illustrates how to process events with a general callback function.
. . .
BrokerBoolean sample_callback(BrokerClient c, BrokerEvent e, void *data);
. . .
/* Create a client */
. . .
/* Check if can subscribe */
. . .
/* Register a general callback */
err = awRegisterCallback(c, sample_callback, NULL);
if (err != AW_NO_ERROR) {
printf("Error on registering callback\n%s\n", awErrorToString(err));
return 0;
}
/* Open the subscription */
err = awNewSubscription(c,"Sample::SimpleEvent",NULL);
. . .
/* Do the main loop */
err = awMainLoop();
if (err != AW_NO_ERROR) {
printf("Error in main loop\n%s\n",awErrorToString(err));
return 0;
}
. . .