Package com.yahoo.documentapi.messagebus
Class MessageBusVisitorDestinationSession
java.lang.Object
com.yahoo.documentapi.messagebus.MessageBusVisitorDestinationSession
- All Implemented Interfaces:
VisitorControlSession
,VisitorDestinationSession
,com.yahoo.messagebus.MessageHandler
public class MessageBusVisitorDestinationSession
extends Object
implements VisitorDestinationSession, com.yahoo.messagebus.MessageHandler
A visitor destination session for receiving data from a visitor using a
messagebus destination session. The default behaviour of the visitor session
is to control visiting and receive the data. As an alternative, you may set
up one or more visitor destination sessions and tell the visitor to send
data to the remote destination(s). This is convenient if you want to receive
data decoupled from controlling the visitor, but also to avoid a single data
destination becoming a bottleneck.
Create the visitor destination session by calling the
MessageBusDocumentAccess.createVisitorDestinationSession
method. The visitor must be started by calling the
MessageBusDocumentAccess.createVisitorSession
method and
progress tracked through the resulting visitor session.
- Author:
- Thomas Gundersen
-
Constructor Summary
ConstructorDescriptionMessageBusVisitorDestinationSession
(VisitorDestinationParameters params, com.yahoo.messagebus.MessageBus bus) Creates a message bus visitor destination session. -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Aborts the session.void
Acknowledges a response previously retrieved by thegetNext
method.void
destroy()
Destroys this session and frees up any resources it has held.getNext()
Returns the next response of this session.getNext
(int timeoutMilliseconds) Returns the next response of this session.void
handleMessage
(com.yahoo.messagebus.Message message)
-
Constructor Details
-
MessageBusVisitorDestinationSession
public MessageBusVisitorDestinationSession(VisitorDestinationParameters params, com.yahoo.messagebus.MessageBus bus) Creates a message bus visitor destination session.- Parameters:
params
- the parameters for the visitor destination sessionbus
- the message bus to use
-
-
Method Details
-
handleMessage
public void handleMessage(com.yahoo.messagebus.Message message) - Specified by:
handleMessage
in interfacecom.yahoo.messagebus.MessageHandler
-
ack
Description copied from interface:VisitorControlSession
Acknowledges a response previously retrieved by thegetNext
method.- Specified by:
ack
in interfaceVisitorControlSession
- Parameters:
token
- The ack token. You must get this from the visitor response returned by thegetNext
method.
-
destroy
public void destroy()Description copied from interface:VisitorControlSession
Destroys this session and frees up any resources it has held.- Specified by:
destroy
in interfaceVisitorControlSession
-
abort
public void abort()Description copied from interface:VisitorControlSession
Aborts the session.- Specified by:
abort
in interfaceVisitorControlSession
-
getNext
Description copied from interface:VisitorControlSession
Returns the next response of this session. This method returns immediately.- Specified by:
getNext
in interfaceVisitorControlSession
- Returns:
- the next response, or null if no response is ready at this time
-
getNext
Description copied from interface:VisitorControlSession
Returns the next response of this session. This will block until a response is ready or until the given timeout is reached- Specified by:
getNext
in interfaceVisitorControlSession
- Parameters:
timeoutMilliseconds
- the max time to wait for a response. If the number is 0, this will block without any timeout limit- Returns:
- the next response, or null if no response becomes ready before the timeout expires
- Throws:
InterruptedException
- if this thread is interrupted while waiting
-