Class CatchupSubscriptionModelConfig
java.lang.Object
org.occurrent.subscription.blocking.durable.catchup.CatchupSubscriptionModelConfig
Configuration for
CatchupSubscriptionModel-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intfinal org.occurrent.eventstore.api.SortBy -
Constructor Summary
ConstructorsConstructorDescriptionCatchupSubscriptionModelConfig(int cacheSize) Create a newCatchupSubscriptionModelConfigwill the given cache size.CatchupSubscriptionModelConfig(int cacheSize, SubscriptionPositionStorageConfig subscriptionStorageConfig) Create a newCatchupSubscriptionModelConfigwill the given settings.CatchupSubscriptionModelConfig(SubscriptionPositionStorageConfig subscriptionStorageConfig) Create a newCatchupSubscriptionModelConfigwill the given subscription storage config. -
Method Summary
Modifier and TypeMethodDescriptioncatchupPhaseSortBy(org.occurrent.eventstore.api.SortBy sortBy) Specify how to sort the events that are read from the event store during catch-up phase.booleaninthashCode()toString()
-
Field Details
-
cacheSize
public final int cacheSize -
subscriptionStorageConfig
-
catchupPhaseSortBy
public final org.occurrent.eventstore.api.SortBy catchupPhaseSortBy
-
-
Constructor Details
-
CatchupSubscriptionModelConfig
public CatchupSubscriptionModelConfig(int cacheSize) Create a newCatchupSubscriptionModelConfigwill the given cache size. Will default to sort by time and then stream version (if time is the same for two events) during the catchup phase. You can change this by callingcatchupPhaseSortBy(SortBy).- Parameters:
cacheSize- The number of cloud events id's to store in-memory when switching from "catch-up" mode (i.e. querying theEventStoreQueriesAPI) and "subscription" mode (Subscription). The cache is needed to reduce the number of duplicate events the occurs when switching.
-
CatchupSubscriptionModelConfig
Create a newCatchupSubscriptionModelConfigwill the given subscription storage config. Will default to sort by time and then stream version (if time is the same for two events) during the catchup phase. You can change this by callingcatchupPhaseSortBy(SortBy).- Parameters:
subscriptionStorageConfig- Configures if and how subscription position persistence should be handled during the catch-up phase.
-
CatchupSubscriptionModelConfig
public CatchupSubscriptionModelConfig(int cacheSize, SubscriptionPositionStorageConfig subscriptionStorageConfig) Create a newCatchupSubscriptionModelConfigwill the given settings. Will default to sort by time and then stream version (if time is the same for two events) during the catchup phase. You can change this by callingcatchupPhaseSortBy(SortBy).- Parameters:
cacheSize- The number of cloud events id's to store in-memory when switching from "catch-up" mode (i.e. querying theEventStoreQueriesAPI) and "subscription" mode (Subscription). The cache is needed to reduce the number of duplicate events the occurs when switching.subscriptionStorageConfig- Configures if and how subscription position persistence should be handled during the catch-up phase.
-
-
Method Details
-
catchupPhaseSortBy
public CatchupSubscriptionModelConfig catchupPhaseSortBy(org.occurrent.eventstore.api.SortBy sortBy) Specify how to sort the events that are read from the event store during catch-up phase. By default, "natural order" is used when no filter is specified, and time then stream version, if time is the same for two events. If you know that you're reading from a datastore that has insertion order support, or if you need a different sort events after they've been filtered by theCatchupSubscriptionModel, you can specify your ownsortByinstance here. Note that you most likely need thesortByinstance be covered by an index for it to work efficiently.For example, in MongoDB, if you only sort by "time", then if two events have the exact same time, then the order returned from MongoDB is unspecified. Thus the default value of
sortByisSortBy.ascending(TIME, STREAM_VERSION). However, say that your filter isFilter.type(", then you could create an index,") {type : 1, time : 1, _id : 1}, and callcatchupPhaseSortBy(SortBy)withSortBy.ascending(TIME, "_id"). This means that MongoDB can efficiently both search for the correct type and then perform a sort based on time, but use "insertion order" if time is the same for two or more events. If you don't supply a filter, then you can instead create the index{time : 1, _id : 1}.- Parameters:
sortBy- TheSortByinstance to use during catchup phase. Default isSortBy.ascending(TIME, STREAM_VERSION).- Returns:
- A new instance of
CatchupSubscriptionModel.
-
equals
-
hashCode
public int hashCode() -
toString
-