Class MessageBusVisitorDestinationSession

  • All Implemented Interfaces:
    VisitorControlSession, VisitorDestinationSession, com.yahoo.messagebus.MessageHandler

    public class MessageBusVisitorDestinationSession
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abort()
      Aborts the session.
      void ack​(AckToken token)
      Acknowledges a response previously retrieved by the getNext method.
      void destroy()
      Destroys this session and frees up any resources it has held.
      VisitorResponse getNext()
      Returns the next response of this session.
      VisitorResponse getNext​(int timeoutMilliseconds)
      Returns the next response of this session.
      void handleMessage​(com.yahoo.messagebus.Message message)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • 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.
      • 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