001package com.box.sdk;
002
003/**
004 * The listener interface for receiving events from an {@link EventStream}.
005 */
006public interface EventListener {
007    /**
008     * Invoked when an event is received from the API.
009     *
010     * @param event the received event.
011     */
012    void onEvent(BoxEvent event);
013
014    /**
015     * Invoked when an updated stream position is received from the API.
016     *
017     * @param position of the stream.
018     */
019    void onNextPosition(long position);
020
021    /**
022     * Invoked when an error occurs while waiting for events to be received.
023     *
024     * <p>When an EventStream encounters an exception, it will invoke this method on each of its listeners until one
025     * of them returns true, indicating that the exception was handled.</p>
026     *
027     * @param e the exception that was thrown while waiting for events.
028     * @return true if the exception was handled; otherwise false.
029     */
030    boolean onException(Throwable e);
031}