Hermes MySQL
    Preparing search index...

    Function createEventStorePollingStore

    • Creates the store of the event store for createPollingOutbox with usePartitionOrderingPolicy: a partition is a stream, so the events of a stream are published one by one, in their order, by one instance at a time.

      Every consumer has one row per stream in hermes_subscriptions, which keeps both its checkpoint (the version of the stream it processed) and its claim (owner, lease_until), and the retry of a failed event (attempts, retry_at). A poll registers the streams the consumer does not know yet, finds the streams with new events (changedStreamsQuery) and claims them with FOR UPDATE SKIP LOCKED on the rows of hermes_subscriptions. It never locks hermes_streams, so it does not block appends.

      The version of a stream changes in the same transaction as its events, so a consumer sees a version only together with all the events up to it: an append that commits after a later one is not skipped.

      Parameters

      • getPool: () => Pool

        Returns the pool, preferably of createPollingPool (READ COMMITTED)

      • scope: EventStorePollingStoreScope

        The consumer

      Returns EventStorePollingStore