Delivering Multiple Events
The following example shows the use of the
awDeliverEvents function to deliver multiple events. This function accepts these parameters:
A
BrokerClient pointer.
A string containing the destination identifier (client identifier of the recipient).
A
long containing the number of events in the array.
The array of events 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[5], event;
char *dest_id;
...
/* create the events to be sent and set their event fields */
. . .
/* obtain the client id of the recipient */
err = awGetStringField(event, "_env.pubId", &dest_id);
if (err != AW_NO_ERROR) {
printf("Error on get string\n%s\n", awErrorToString(err));
return 0;
}
/* Deliver the events to the recipient */
err = awDeliverEvents(c, dest_id, 5, e);
if (err != AW_NO_ERROR) {
printf("Error on deliver\n%s\n", awErrorToString(err));
return 0;
}
free(dest_id);
. . .
The
awDeliverEventsWithAck method can be used by your
Broker client to deliver one or more events while, at the same time, acknowledging the receipt of one or more events. For more information on event acknowledgement, see
Using Sequence Numbers.