Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Load Balancing and Failover for Publish Operations | Publishing and Delivering Events | Publishing Multiple Events
 
Publishing Multiple Events
Your application can publish several events with one call to the BrokerClusterPublisher.publish method that accepts an array of BrokerEvent objects. The following example contains an excerpt that shows the use of this method, which accepts a BrokerEvent array.
The following example illustrates how to publish multiple events to territory subscribers:
. . .
BrokerClusterPublisher bcp;
BrokerEvent e[5];
. . .
/* Create and initialize the event array */
. . .
try {
bcp.publish(e);
} catch (BrokerException ex) {
System.out.println("Error on publish\n"+ex);
return;
}
. . .
The following example illustrates how to publish multiple events to subscribers on the local Broker only:
. . .
BrokerClusterPublisher bcp;
BrokerEvent e[5];
. . .
/* Create and initialize the event array */
. . .
try {
bcp.localPublish(e);
} catch (BrokerException ex) {
System.out.println("Error on publish\n"+ex);
return;
}
. . .