public final class ResponseCorrelator extends Object implements PacketCollector
ResponseCorrelator comes to the rescue here and
correlates response to the requests for applications.
When a request is sent to the server, the request carries an id and server
response will also contain the same id which ResponseCorrelator uses
to correlate the response to the request.
| Constructor and Description |
|---|
ResponseCorrelator() |
| Modifier and Type | Method and Description |
|---|---|
void |
collect(Packet packet)
This collector takes the given packet.
|
void |
correlate(String id)
Correlates given request id with a response
|
Packet |
getCorrelatedResponse(String id)
Returns
IQ packet received as the response of the request sent to
server with given id. |
String |
getCorrelationId()
Generates a request id which is added response awaiting requests list
|
public void correlate(String id)
id - correlationidpublic String getCorrelationId()
public Packet getCorrelatedResponse(String id) throws TimeoutException
IQ packet received as the response of the request sent to
server with given id. If server fails to respond within the time
specified by timeout property, TimeoutException is thrown.id - corelation idPacketTimeoutException - timeoutpublic void collect(Packet packet)
PacketCollectorcollect in interface PacketCollectorpacket - packet instance to be collectedCopyright © 2019. All rights reserved.