The
client group to which the
BrokerClient belongs may limit the event types to which the
Broker client may subscribe. See
Client Groups for more information. The following example contains an excerpt from the
subscribe1.c sample application that shows the use of the
awCanSubscribe function to check for event subscription permission. The function requires these parameters:
. . .
BrokerClient c;
BrokerBoolean can_subscribe;
. . .
/* Check if can subscribe */
err = awCanSubscribe(c, "Sample::SimpleEvent", &can_subscribe);
if (err != AW_NO_ERROR) {
printf("Error on check for can subscribe\n%s\n", awErrorToString(err));
return 0;
}
if (can_subscribe == 0) {
printf("Cannot subscribe to event Sample::SimpleEvent.\n");
printf("Make sure it is loaded in the broker and \n");
printf("permission is given to subscribe to it in the \n");
printf("%s client group.\n", client_group);
return 0;
}
. . .
You can also use the
awGetCanSubscribeNames function to obtain the names of all the event types to which a
Broker client can subscribe.