Interface IEMessageStore

  • All Known Implementing Classes:
    InMemoryMessageStore, SqlMessageStore

    public interface IEMessageStore
    This interface provides EHistoricPublishFeed the ability to persist notification messages and to retrieve those message for a given historic time interval. Notification messages are persisted when an historic publisher publishes a notification message. Notification messages are retrieved when EHistoricPublishFeed receives a request for historic messages.

    Please note that this message store is not only used to persist application notification messages but also PublishStatusEvent messages.

    An IEMessageStore instance may be shared among multiple EHistoricPublishFeeds but the implementation is responsible for maintaining thread-safety.

    When building an EHistoricPublishFeed, a non-null, open message store must be passed to EHistoricPublishFeed.Builder.messageStore(IEMessageStore). Failure to do so results in an exception. The appropriate opening and closing of the IEMessageStore is outside the scope of the historic publish feed and left up to the application. The restriction is that the message store must be opened prior to opening the historic publish feed and closed after closing the historic publish feed.

    It is left up to the implementation to decide how messages are persisted or retrieved.

    Publishing multiple updates to one subject.

    Consider the following: the status for five different connections are published and stored for a single subject. Subscribers need only subscribe to a single subject to receive updates on all five connections. The problem is retrieving the latest update notification for these five connections. If retrieve(EInterval) for a {now, now} interval is handled literally, then only the very latest notification is returned which means the subscriber is missing status for the four other notifications.

    A better solution is to interpret this interval as the latest notification for each of the five connections - which is what the subscriber expects. It is up to the IEMessageStore implementation to decide how to achieve this.

    Author:
    Charles W. Rapp
    See Also:
    EHistoricPublishFeed, EInterval
    • Method Detail

      • isOpen

        boolean isOpen()
        Returns true if this message store is open and ready to store or retrieve notification messages.
        Returns:
        true if message store is open.
      • key

        EMessageKey key()
        Returns message key associated with message store.
        Returns:
        message store's associated key.
      • retrieve

        Collection<ENotificationMessage> retrieve​(EInterval interval)
        Retrieves historic messages as defined by given date/time interval. Returned collection may be empty but never null.

        There are three interval types:

        1. {past, past}: retrieved notifications are entirely in the past.
        2. {past, now}: retrieve notifications are from the past to the most recently stored notification.
        3. {now, now}: retrieve only the latest notifications. See IEMessageStore class documentation on this specific retrieval.

        Please note that implementation are not required to validate interval since this is performed by EHistoricPublishFeed. That said, such validation is encourage if store is used outside of eBus historic feed framework.

        Parameters:
        interval - date/time interval.
        Returns:
        iterator over historic messages. Does not return null but may return iterator where Iterator.hasNext() returns false.
        See Also:
        store(ENotificationMessage)