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 final 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
ConstructorsConstructorDescriptionMessageBusVisitorDestinationSession(VisitorDestinationParameters params, com.yahoo.messagebus.MessageBus bus) Creates a message bus visitor destination session. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts the session.voidAcknowledges a response previously retrieved by thegetNextmethod.voiddestroy()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.voidhandleMessage(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:
handleMessagein interfacecom.yahoo.messagebus.MessageHandler
-
ack
Description copied from interface:VisitorControlSessionAcknowledges a response previously retrieved by thegetNextmethod.- Specified by:
ackin interfaceVisitorControlSession- Parameters:
token- The ack token. You must get this from the visitor response returned by thegetNextmethod.
-
destroy
public void destroy()Description copied from interface:VisitorControlSessionDestroys this session and frees up any resources it has held.- Specified by:
destroyin interfaceVisitorControlSession
-
abort
public void abort()Description copied from interface:VisitorControlSessionAborts the session.- Specified by:
abortin interfaceVisitorControlSession
-
getNext
Description copied from interface:VisitorControlSessionReturns the next response of this session. This method returns immediately.- Specified by:
getNextin interfaceVisitorControlSession- Returns:
- the next response, or null if no response is ready at this time
-
getNext
Description copied from interface:VisitorControlSessionReturns the next response of this session. This will block until a response is ready or until the given timeout is reached- Specified by:
getNextin 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
-