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 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 session
      bus - the message bus to use
  • Method Details

    • handleMessage

      public void handleMessage(com.yahoo.messagebus.Message message)
      Specified by:
      handleMessage in interface com.yahoo.messagebus.MessageHandler
    • ack

      public void ack(AckToken token)
      Description copied from interface: VisitorControlSession
      Acknowledges a response previously retrieved by the getNext method.
      Specified by:
      ack in interface VisitorControlSession
      Parameters:
      token - The ack token. You must get this from the visitor response returned by the getNext 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 interface VisitorControlSession
    • abort

      public void abort()
      Description copied from interface: VisitorControlSession
      Aborts the session.
      Specified by:
      abort in interface VisitorControlSession
    • getNext

      public VisitorResponse getNext()
      Description copied from interface: VisitorControlSession
      Returns the next response of this session. This method returns immediately.
      Specified by:
      getNext in interface VisitorControlSession
      Returns:
      the next response, or null if no response is ready at this time
    • getNext

      public VisitorResponse getNext(int timeoutMilliseconds) throws InterruptedException
      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 interface VisitorControlSession
      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