Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using Request-Reply | The Server | Processing Request Events
 
Processing Request Events
Your server application has all of the usual options for receiving and processing events. It can use the BrokerClient.getEvent method to receive events within a manually coded loop, described in Chapter 4. If your server subscribes to several request event types, it can use the callback model described in Using the Callback Model.
The server application can also associate an identifier with each of the subscriptions that it registers. When an event is received, the server application can easily determine how to process the request event. See Subscription Identifiers for more information.
The following example shows an excerpt of a server application that uses BrokerClient.getEvent method to receive an event and determines if it is a request event.
. . .
BrokerClient c;
BrokerEvent e;
int n, count = 200;
String event_type_name;
. . .
/* Loop getting events */
n = 1;
while(n < count) {
try {
e = c.getEvent(-1);
} catch (BrokerException ex) {
. . .
}
/* Check if it is a request */
try {
event_type_name = e.getEventTypeName();
} catch (BrokerException ex) {
. . .
}
if ((event_type_name != null) &&
(event_type_name.equals("Sample::Request")) {
/* Process the request (see following excerpts) */
. . .