View Source Kelvin.InOrderSubscription (Kelvin v1.0.0)
A subscription producer which processes events in order as they appear in the EventStoreDB
options
Options
:name
- (optional) the GenServer name for this producer:stream_name
- (required) the stream name to which to subscribe:connection
- (required) the Extreme client module to use as a connection to the EventStoreDB. This may either be the name of the Extreme client module or its pid.:restore_stream_position!
- (required) a function which determines the stream position from which this listener should begin after initializing or restarting. Values may be either an MFA tuple or a 0-arity anonymous function.:subscribe_on_init?
- (required) a function which determines whether the producer should subscribe immediately after starting up. Values may be either an MFA tuple or a 0-arity anonymous function. The function should return eithertrue
to subscribe immediately on initialization orfalse
if the author intends on manually subscribing the producer. This producer can be manually subscribed bysend/2
ing a message of:subscribe
to the process.:subscribe_after
- (default:Enum.random(3_000..5_000)
) the amount of time to wait after initializing to query the:subscribe_on_init?
option. This can be useful to prevent all producers from trying to subscribe at the same time and to await an active connection to the EventStoreDB.:catch_up_chunk_size
- (default:256
) the number of events to query for each read chunk while catching up. This option presents a trade-off between network queries and query duration over the network.