Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client C API Programmer's Guide | Using the Callback Model | Specific Callback Functions | Using Specific Callbacks
 
Using Specific Callbacks
The example below illustrates the use of the awRegisterCallbackForSubId function to register a specific callback function.
. . .
BrokerBoolean general_callback(BrokerClient c, BrokerEvent e,
void *data);
BrokerBoolean specific_callback(BrokerClient c, BrokerEvent e,
void *data);
/* Check if can subscribe */
. . .
/* Register a general callback */
err = awRegisterCallback(c, general_callback, NULL);
if (err != AW_NO_ERROR) {
printf("Error on registering callback\n%s\n", awErrorToString(err));
return 0;
}
/* Register a specific callback */
err = awRegisterCallbackForSubId(c, 1, specific_callback, NULL);
if (err != AW_NO_ERROR) {
printf("Error on registering callback\n%s\n", awErrorToString(err));
return 0;
}
/* Open the subscription with the ID of 1 */
err = awNewSubscriptionWithId(c, 1, "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;
}
. . .