Interface MessageStorage

All Known Implementing Classes:
AbstractFileMessageStorage, ChronicleQueueStorage, FlatFileMessageStorage, IndexedMessageStorage, MMFIndexedMessageStorage, MMFMessageStorage, SlicedFileMessageStorage, SlicedIndexedMessageStorage

public interface MessageStorage
The common message storage interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendMessage(byte[] message)
    Appends message to storage.
    default void
    appendMessage(byte[] timestampFormatted, byte[] message)
    Appends message to storage with the given formatted timestampFormatted.
    default void
    appendMessage(byte[] timestampFormatted, byte[] message, int offset, int length)
    Appends message to storage with the given formatted timestamp.
    void
    appendMessage(byte[] message, int offset, int length)
    Appends message to storage.
    void
    backupStorage(SessionParameters sessionParameters)
    Backup the storage.
    void
    Close the storage.
    long
    Initialize the storage.
    byte[]
    retrieveMessage(long seqNumber)
    Retrieves message from storage.
    void
    retrieveMessages(long fromSeqNum, long toSeqNun, MessageStorageListener listener, boolean blocking)
    Retrieves message from storage.
  • Method Details

    • initialize

      long initialize() throws IOException
      Initialize the storage.
      Returns:
      the next sequence number
      Throws:
      IOException - - if error occurred.
    • appendMessage

      void appendMessage(byte[] message, int offset, int length) throws IOException
      Appends message to storage.
      Parameters:
      message - the message
      offset - the initial offset
      length - the length
      Throws:
      IOException - - if error occurred.
    • appendMessage

      void appendMessage(byte[] message) throws IOException
      Appends message to storage.
      Parameters:
      message - the message
      Throws:
      IOException - - if error occurred.
    • appendMessage

      default void appendMessage(byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException
      Appends message to storage with the given formatted timestamp.
      Parameters:
      timestampFormatted - the message timestamp
      message - the message
      offset - the initial offset
      length - the length
      Throws:
      IOException - - if error occurred.
    • appendMessage

      default void appendMessage(byte[] timestampFormatted, byte[] message) throws IOException
      Appends message to storage with the given formatted timestampFormatted.
      Parameters:
      timestampFormatted - the message timestampFormatted
      message - the message
      Throws:
      IOException - - if error occurred.
    • retrieveMessage

      byte[] retrieveMessage(long seqNumber) throws IOException
      Retrieves message from storage.
      Parameters:
      seqNumber - the sequence number of message
      Returns:
      the retrieved message
      Throws:
      IOException - - if error occurred.
    • retrieveMessages

      void retrieveMessages(long fromSeqNum, long toSeqNun, MessageStorageListener listener, boolean blocking) throws IOException
      Retrieves message from storage.
      Parameters:
      fromSeqNum - the from sequence number
      toSeqNun - the to sequence number
      listener - the callback listener
      blocking - if parameter is true, the execution start in current thread context, otherwise in the new thread context.
      Throws:
      IOException - - if error occurred.
    • close

      void close() throws IOException
      Close the storage.
      Throws:
      IOException - - if error occurred.
    • backupStorage

      void backupStorage(SessionParameters sessionParameters) throws IOException
      Backup the storage.
      Parameters:
      sessionParameters - the session parameters
      Throws:
      IOException