Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Publishing and Delivering Events | Delivering Events | Delivering Multiple Events
 
Delivering Multiple Events
The following example shows the use of the BrokerClient.deliver method to deliver multiple events. This method accepts these parameters:
*A string containing the destination identifier (client identifier of the recipient).
*The array of events to be delivered.
Delivering multiple events
. . .
BrokerClient c;
BrokerEvent e[5];
BrokerEvent event;
String dest_id;
...
/* create the events to be sent and set their event fields */
. . .
/* obtain the client id of the recipient */
try {
dest_id = event.getStringField("_env.pubId");
} catch (BrokerException ex) {
System.out.println("Error on getting destination ID\n"+ex);
return;
}
/* Deliver the event to the recipient */
try {
c.deliver( dest_id, e);
} catch (BrokerException ex) {
System.out.println("Error on delivering events\n"+ex);
return;
}
. . .
The BrokerClient.deliverWithAck 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.