Class MessageBusVisitorSession

  • All Implemented Interfaces:
    VisitorControlSession, VisitorSession

    public class MessageBusVisitorSession
    extends java.lang.Object
    implements VisitorSession

    A visitor session for tracking progress for and potentially receiving data from a visitor using a MessageBus source and destination session. The source session is used to initiate visiting by sending create visitor messages to storage and the destination session is used for receiving progress. If the visitor is not set up to send data to a remote destination, data will also be received through the destination session.

    Create the visitor session by calling the DocumentAccess.createVisitorSession method.

    • Method Detail

      • createForMessageBus

        public static MessageBusVisitorSession createForMessageBus​(com.yahoo.messagebus.MessageBus mbus,
                                                                   java.util.concurrent.ScheduledExecutorService scheduledExecutorService,
                                                                   VisitorParameters params)
                                                            throws com.yahoo.document.select.parser.ParseException
        Throws:
        com.yahoo.document.select.parser.ParseException
      • start

        public void start()
      • getSessionName

        public java.lang.String getSessionName()
      • isDone

        public boolean isDone()
        Description copied from interface: VisitorSession
        Checks if visiting is done.
        Specified by:
        isDone in interface VisitorSession
        Returns:
        True if visiting is done (either by error or success).
      • getTrace

        public com.yahoo.messagebus.Trace getTrace()
        Description copied from interface: VisitorSession
        Returns the tracing information so far about the visitor.
        Specified by:
        getTrace in interface VisitorSession
        Returns:
        Returns the trace.
      • waitUntilDone

        public boolean waitUntilDone​(long timeoutMs)
                              throws java.lang.InterruptedException
        Description copied from interface: VisitorSession
        Waits until visiting is done, or the given timeout (in ms) expires. Will wait forever if timeout is 0.
        Specified by:
        waitUntilDone in interface VisitorSession
        Parameters:
        timeoutMs - The maximum amount of milliseconds to wait.
        Returns:
        True if visiting is done (either by error or success).
        Throws:
        java.lang.InterruptedException - If an interrupt signal was received while waiting.
      • 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.
      • getNext

        public VisitorResponse getNext​(int timeoutMilliseconds)
                                throws java.lang.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:
        java.lang.InterruptedException - if this thread is interrupted while waiting
      • isDestroying

        public boolean isDestroying()
        For unit test purposes only, not to be used by any external parties.
        Returns:
        true if destroy() has been--or is being--invoked.