Interface IEMessageStore
-
- All Known Implementing Classes:
InMemoryMessageStore,SqlMessageStore
public interface IEMessageStoreThis interface providesEHistoricPublishFeedthe ability to persist notification messages and to retrieve those message for a given historic time interval. Notification messages are persisted when anhistoric publisherpublishesa notification message. Notification messages are retrieved whenEHistoricPublishFeedreceives arequest for historic messages.Please note that this message store is not only used to persist application notification messages but also
PublishStatusEventmessages.An
IEMessageStoreinstance may be shared among multipleEHistoricPublishFeeds but the implementation is responsible for maintaining thread-safety.When building an
EHistoricPublishFeed, a non-null, open message store must be passed toEHistoricPublishFeed.Builder.messageStore(IEMessageStore). Failure to do so results in an exception. The appropriate opening and closing of theIEMessageStoreis 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. Ifretrieve(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
IEMessageStoreimplementation to decide how to achieve this.- Author:
- Charles W. Rapp
- See Also:
EHistoricPublishFeed,EInterval
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisOpen()Returnstrueif this message store is open and ready to store or retrieve notification messages.EMessageKeykey()Returns message key associated with message store.Collection<ENotificationMessage>retrieve(EInterval interval)Retrieves historic messages as defined by given date/time interval.voidstore(ENotificationMessage message)Persists given notification message to store.
-
-
-
Method Detail
-
isOpen
boolean isOpen()
Returnstrueif this message store is open and ready to store or retrieve notification messages.- Returns:
trueif message store is open.
-
key
EMessageKey key()
Returns message key associated with message store.- Returns:
- message store's associated key.
-
store
void store(ENotificationMessage message)
Persists given notification message to store.- Parameters:
message- persist this message.- Throws:
NullPointerException- ifmessageisnull.- See Also:
retrieve(EInterval)
-
retrieve
Collection<ENotificationMessage> retrieve(EInterval interval)
Retrieves historic messages as defined by given date/time interval. Returned collection may be empty but nevernull.There are three interval types:
-
{
past,past}: retrieved notifications are entirely in the past. -
{
past,now}: retrieve notifications are from the past to the most recently stored notification. -
{
now,now}: retrieve only the latest notifications. SeeIEMessageStoreclass documentation on this specific retrieval.
Please note that implementation are not required to validate
intervalsince this is performed byEHistoricPublishFeed. 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
nullbut may return iterator whereIterator.hasNext()returnsfalse. - See Also:
store(ENotificationMessage)
-
{
-
-