Delivering an Event
The following example shows the use of the
awDeliverEvent function to deliver a single event. This function accepts these parameters:
A
BrokerClient handle.
A string containing the destination identifier (client identifier of the recipient).
The
BrokerEvent to be delivered.
Note:
An error will not be returned if the recipient, represented by the destination identifier, no longer exists.
. . .
BrokerClient c;
BrokerEvent e, event;
char *dest_id;
. . .
/* create a client */
. . .
/* open any subscriptions */
. . .
/* receive an event */
. . .
/* create the event to be delivered and set the event fields */
. . .
/* obtain the client id of the recipient from the received event */
err = awGetStringField( event, "_env.pubId", &dest_id);
if (err != AW_NO_ERROR) {
printf("Error on get tag\n%s\n", awErrorToString(err));
return 0;
}
/* Deliver the event to the recipient */
err = awDeliverEvent(c, dest_id, e);
if (err != AW_NO_ERROR) {
printf("Error on deliver\n%s\n", awErrorToString(err));
return 0;
}
free(dest_id);
. . .