public abstract class VisitorDataHandler extends Object
Use a data handler that fits your needs to be able to use visiting easily.
Modifier and Type | Field and Description |
---|---|
protected VisitorControlSession |
session |
Constructor and Description |
---|
VisitorDataHandler()
Creates a new visitor data handler.
|
Modifier and Type | Method and Description |
---|---|
void |
ack(AckToken token)
Function used to ack data.
|
VisitorResponse |
getNext()
Returns the next response of this session.
|
VisitorResponse |
getNext(int timeoutMilliseconds)
Returns the next response of this session.
|
void |
onDone()
Called when visiting is done, to notify clients waiting on getNext().
|
abstract void |
onMessage(com.yahoo.messagebus.Message m,
AckToken token)
Called when a data message is received.
|
void |
reset()
Called before the visitor starts.
|
void |
setSession(VisitorControlSession session)
Sets which session this visitor data handler belongs to.
|
protected VisitorControlSession session
public VisitorDataHandler()
public void reset()
public void setSession(VisitorControlSession session)
session
- the session currently using this data handlerpublic VisitorResponse getNext()
UnsupportedOperationException
- if data handler does not support
the operationpublic VisitorResponse getNext(int timeoutMilliseconds) throws InterruptedException
timeoutMilliseconds
- the max time to wait for a response. If the
number is 0, this will block without any
timeout limitInterruptedException
- if this thread is interrupted while waitingUnsupportedOperationException
- if data handler does not support
the operationpublic void onDone()
public abstract void onMessage(com.yahoo.messagebus.Message m, AckToken token)
m
- The message receivedtoken
- A token to reply with when finished processing the message.public void ack(AckToken token)
token
- The token to ack. Gotten from an earlier callback.Copyright © 2018. All rights reserved.