Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using Request-Reply | The Server | Delivering Replies | Delivering Partial Replies
 
Delivering Partial Replies
Your server application might need to deliver multiple reply events to satisfy a request event that it receives. If all of the reply event data cannot be read into memory or is not immediately available, the server can choose to send the reply events in batches rather than all at once.
The BrokerClient.deliverPartialReplyEvents method can be used in these cases. You must set the flag parameter to REPLY_FLAG_START, REPLY_FLAG_CONTINUE, or REPLY_FLAG_END to indicate the start, continuation, and end of the reply event sequence.
If all of the replies can be sent in one batch, simply set the flag to REPLY_FLAG_START_AND_END.
BrokerEvent reply_events[];
int token, flag;
boolean done = false;
. . .
/* prepare some reply events */
. . .
flag = BrokerClient.REPLY_FLAG_START;
while(!done) {
try {
token = c.deliverPartialReplyEvents(e, reply_events,
flag, token);
} catch (BrokerException ex) {
...
}
/* prepare more reply events */
. . .
flag = BrokerClient.REPLY_FLAG_CONTINUE;
}
flag = BrokerClient.REPLY_FLAG_END;
/* prepare the last reply event */
. . .
try {
token = c.deliverPartialReplyEvents(e, reply_events,
flag, token);
} catch (BrokerException ex) {
. . .
}
. . .