Interface EventQueue

    • Constructor Detail

    • Method Detail

      • enqueue

         abstract Unit enqueue(E item)

        Adds an item to the event queue.

        Parameters:
        item - The item to be enqueued.
      • dequeue

         abstract SendResult dequeue(SuspendFunction1<List<E>, Boolean> action)

        Dequeues a batch of events from the queue and processes them using the specified action.

        This method must be thread-safe. Use Mutex to ensure exclusive access to the queue if necessary.

        Also, action is expected not to throw exceptions. If an exception is thrown, it will be interpreted as a catastrophic problem with the event log data and the respective data should be discarded.

        Parameters:
        action - A suspending function that processes a list of events.
        Returns:

        A pair containing a boolean indicating if the operation was successful, and the duration to delay before the next dequeue attempt. Duration may be zero if dequeue can be executed immediately

      • close

         abstract Unit close()

        Closes the event queue, releasing any allocated resources or file handles.

        This method ensures that the underlying resources, such as files or connections, associated with the event queue are properly closed and cleaned up. It should be called when the event queue is no longer needed to prevent resource leaks.