Package net.sf.eBus.feed.historic.store
Class InMemoryMessageStore.Builder
- java.lang.Object
-
- net.sf.eBus.feed.historic.store.InMemoryMessageStore.Builder
-
- Enclosing class:
- InMemoryMessageStore
public static final class InMemoryMessageStore.Builder extends Object
InMemoryMessageStoreinstances are created using aBuilder. ABuilderinstance is acquired fromInMemoryMessageStore.builder(). The following attributes must be set to successfully build an in-memory message store:-
non-
nulleBus notificationmessage keyand - maximum store capacity > zero.
Once these values are correctly set, the target
InMemoryMessageStoreinstance is created by callingbuild().
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InMemoryMessageStorebuild()Returns newInMemoryMessageStorebased on this builder's settings.InMemoryMessageStore.Builderkey(EMessageKey key)Sets eBus notification message key.InMemoryMessageStore.BuildermaximumCapacity(int n)Sets in-memory message store maximum capacity.
-
-
-
Method Detail
-
key
public InMemoryMessageStore.Builder key(EMessageKey key)
Sets eBus notification message key. All message stored or retrieved from database must have this message key.- Parameters:
key- eBus notification message key.- Returns:
this Builderinstance.- Throws:
NullPointerException- ifkeyisnull.IllegalArgumentException- ifkeyis not an eBusnotification message.
-
maximumCapacity
public InMemoryMessageStore.Builder maximumCapacity(int n)
Sets in-memory message store maximum capacity. Once this capacity is reached, the oldest message in the store is replaced with the latest message.- Parameters:
n- message store capacity.- Returns:
this Builderinstance.- Throws:
IllegalArgumentException- ifnis ≤ zero.
-
build
public InMemoryMessageStore build()
Returns newInMemoryMessageStorebased on this builder's settings.- Returns:
- new in-memory message store instance.
- Throws:
net.sf.eBus.util.ValidationException- if this builder's settings are incomplete or invalid.
-
-