Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client C API Programmer's Guide | Subscribing to and Receiving Events | Receiving Events in the Get-Events Model | Subscription Identifiers | Obtaining Subscription Identifiers
 
Obtaining Subscription Identifiers
The following example shows how you could use the awGetSubscriptionIds function to obtain the subscription identifier of a retrieved event.
Note:
If the filter string specified for two or more subscriptions have overlapping criteria, it is possible for a retrieved event to be associated with more than one subscription identifier. For more information on event filters, see Managing Event Types.
The following example assumes that the subscriptions described in the previous example have already been made and that there is only one subscription identifier associated with any retrieved event. The awGetSubscriptionIds function accepts these parameters:
*A BrokerEvent handle.
*The address of a long where the subscription ID can be stored.
. . .
long *subscriptions;
long num_subs_returned;
. . .
while(1) {
err = awGetEvent(c, AW_INFINITE, &e);
if (err != AW_NO_ERROR) {
printf("Error on getting event\n%s\n", awErrorToString(err));
return 0;
}
/* get the event's subscription number */
subscriptions = awGetSubscriptionIds(e, &num_subs_returned);
if( subscriptions != NULL) {
switch( subscriptions[0] ) {
case 1:
/* process Sample::SimpleEvent1 . . . */
break;
case 2:
/* process Sample::SimpleEvent2 . . .*/
break;
default:
break;
}
}
awDeleteEvent(e);
}
. . .
Note:
Events that are delivered to your Broker client do not have subscriptions or subscription IDs. For more information on delivering events, see Delivering Events.