Class HibernateOrmMapperOutboxPollingSettings


  • @Incubating
    public final class HibernateOrmMapperOutboxPollingSettings
    extends Object
    • Field Detail

      • PREFIX

        public static final String PREFIX
        The prefix expected for the key of every Hibernate Search configuration property when using the Hibernate ORM mapper.
        See Also:
        Constant Field Values
      • COORDINATION_STRATEGY_NAME

        public static final String COORDINATION_STRATEGY_NAME
        The name of the outbox polling strategy, to be set on the HibernateOrmMapperSettings.COORDINATION_STRATEGY configuration property in order to use this strategy.

        With outbox polling, one or multiple application nodes exist, and they coordinate with each other by pushing data to additional tables in the database and polling these tables.

        See the reference documentation for a comparison of all available coordination strategies and possible architectures.

        See Also:
        Constant Field Values
      • COORDINATION_TENANTS

        public static final String COORDINATION_TENANTS
        The root property for coordination properties specific to a tenant, e.g. "hibernate.search.coordination.tenants.tenant1.something = somevalue".
        See Also:
        Constant Field Values
      • COORDINATION_EVENT_PROCESSOR_SHARDS_TOTAL_COUNT

        public static final String COORDINATION_EVENT_PROCESSOR_SHARDS_TOTAL_COUNT
        The total number of shards across all application nodes for event processing.

        WARNING: This property must have the same value for all application nodes, and must never change unless all application nodes are stopped, then restarted. Failing that, some events may not be processed or may be processed twice or in the wrong order, resulting in errors and/or out-of-sync indexes.

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        When this property is set, "hibernate.search.coordination.event_processor.shards.assigned" must also be set.

        Expects an Integer value of at least 2, or a String that can be parsed into such Integer value.

        No default: must be provided explicitly if you want static sharding.

        See Also:
        Constant Field Values
      • COORDINATION_EVENT_PROCESSOR_SHARDS_ASSIGNED

        public static final String COORDINATION_EVENT_PROCESSOR_SHARDS_ASSIGNED
        The indices of shards assigned to this application node for event processing.

        WARNING: shards must be uniquely assigned to one and only one application nodes. Failing that, some events may not be processed or may be processed twice or in the wrong order, resulting in errors and/or out-of-sync indexes.

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        When this property is set, "hibernate.search.coordination.event_processor.shards.total_count" must also be set.

        Expects a shard index, i.e. an Integer value between 0 (inclusive) and the total shard count (exclusive), or a String that can be parsed into such shard index, or a String containing multiple such shard index strings separated by commas, or a Collection<Integer> containing such shard indices.

        No default: must be provided explicitly if you want static sharding.

        See Also:
        Constant Field Values
      • COORDINATION_EVENT_PROCESSOR_POLLING_INTERVAL

        public static final String COORDINATION_EVENT_PROCESSOR_POLLING_INTERVAL
        In the event processor, how long to wait for another query to the outbox events table after a query didn't return any event, in milliseconds.

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        Hibernate Search will wait that long before polling again if the last polling didn't return any event:

        • High values mean higher latency between an entity change and the corresponding update in the index, but less stress on the database when there are no events to process.
        • Low values mean lower latency between an entity change and the corresponding update in the index, but more stress on the database when there are no events to process.

        Expects a positive Integer value in milliseconds, such as 1000, or a String that can be parsed into such Integer value.

        Defaults to HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_EVENT_PROCESSOR_POLLING_INTERVAL.

        See Also:
        Constant Field Values
      • COORDINATION_EVENT_PROCESSOR_PULSE_INTERVAL

        public static final String COORDINATION_EVENT_PROCESSOR_PULSE_INTERVAL
        How long, in milliseconds, the event processor can poll for events before it must perform a "pulse".

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        Every agent registers itself in a database table. Regularly, while polling for events to process, the event processor performs a "pulse": it pauses indexing and:

        • It updates its own entry in the table, to let other agents know it's still alive and prevent an expiration
        • It removes any other agents that expired from the table
        • It suspends itself if it notices a mass indexer is running
        • It performs rebalancing (reassignment of shards) if the number of agents participating in background indexing changed since the last pulse

        The pulse interval must be set to a value between the polling interval and one third (1/3) of the expiration interval:

        • Low values (closer to the polling interval) mean less time wasted not processing events when a node joins or leaves the cluster, and reduced risk of wasting time not processing events because an event processor is incorrectly considered disconnected, but more stress on the database because of more frequent checks of the list of agents.
        • High values (closer to the expiration interval) mean more time wasted not processing events when a node joins or leaves the cluster, and increased risk of wasting time not processing events because an event processor is incorrectly considered disconnected, but less stress on the database because of less frequent checks of the list of agents.

        Expects a positive Integer value in milliseconds, such as 2000, or a String that can be parsed into such Integer value.

        Defaults to HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_EVENT_PROCESSOR_PULSE_INTERVAL.

        See Also:
        Constant Field Values
      • COORDINATION_EVENT_PROCESSOR_PULSE_EXPIRATION

        public static final String COORDINATION_EVENT_PROCESSOR_PULSE_EXPIRATION
        How long, in milliseconds, an event processor "pulse" remains valid before considering the agent disconnected and forcibly removing it from the cluster.

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        Every agent registers itself in a database table. Regularly, while polling for events to process, mass indexer agent performs a "pulse": it pauses what it was doing and (among other things) updates its entry in the table, to let other agents know it's still alive and prevent an expiration. If an agent fails to update its entry for longer than the value of the expiration interval, it will be considered disconnected: other agents will forcibly remove its entry from the table, and will perform rebalancing (reassign shards) as necessary.

        The expiration interval must be set to a value at least 3 times larger than the pulse interval:

        • Low values (closer to the pulse interval) mean less time wasted not processing events when a node abruptly leaves the cluster due to a crash or network failure, but increased risk of wasting time not processing events because an event processor is incorrectly considered disconnected.
        • High values (much larger than the pulse interval) mean more time wasted not processing events when a node abruptly leaves the cluster due to a crash or network failure, but reduced risk of wasting time not processing events because an event processor is incorrectly considered disconnected.

        Expects a positive Integer value in milliseconds, such as 30000, or a String that can be parsed into such Integer value.

        Defaults to HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_EVENT_PROCESSOR_PULSE_EXPIRATION.

        See Also:
        Constant Field Values
      • COORDINATION_EVENT_PROCESSOR_TRANSACTION_TIMEOUT

        public static final String COORDINATION_EVENT_PROCESSOR_TRANSACTION_TIMEOUT
        In the event processor, the timeout for transactions processing outbox events.

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        Only effective when a JTA transaction manager is configured.

        Expects a positive Integer value in seconds, such as 10, or a String that can be parsed into such Integer value.

        When using JTA and this property is not set, Hibernate Search will use whatever default transaction timeout is configured in the JTA transaction manager.

        See Also:
        Constant Field Values
      • COORDINATION_MASS_INDEXER_POLLING_INTERVAL

        public static final String COORDINATION_MASS_INDEXER_POLLING_INTERVAL
        In the mass indexer, how long to wait for another query to the agent table when actively waiting for event processors to suspend themselves, in milliseconds.

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        Hibernate Search will wait that long before polling again when it finds other agents haven't suspended yet:

        • Low values will reduce the time it takes for the mass indexer agent to detect that event processors finally suspended themselves, but will increase the stress on the database while the mass indexer agent is actively waiting.
        • High values will increase the time it takes for the mass indexer agent to detect that event processors finally suspended themselves, but will reduce the stress on the database while the mass indexer agent is actively waiting.

        Expects a positive Integer value in milliseconds, such as 1000, or a String that can be parsed into such Integer value.

        Defaults to HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_MASS_INDEXER_POLLING_INTERVAL.

        See Also:
        Constant Field Values
      • COORDINATION_MASS_INDEXER_PULSE_INTERVAL

        public static final String COORDINATION_MASS_INDEXER_PULSE_INTERVAL
        How long, in milliseconds, the mass indexer can wait before it must perform a "pulse".

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        Every agent registers itself in a database table. Regularly, the mass indexer performs a "pulse":

        • It updates its owm entry in the table, to let other agents know it's still alive and prevent an expiration
        • It removes any other agents that expired from the table

        The pulse interval must be set to a value between the polling interval and one third (1/3) of the expiration interval:

        • Low values (closer to the polling interval) mean reduced risk of event processors starting to process events again during mass indexing because a mass indexer agent is incorrectly considered disconnected, but more stress on the database because of more frequent updates of the mass indexer agent's entry in the agent table.
        • High values (closer to the expiration interval) mean increased risk of event processors starting to process events again during mass indexing because a mass indexer agent is incorrectly considered disconnected, but less stress on the database because of less frequent updates of the mass indexer agent's entry in the agent table.

        Expects a positive Integer value in milliseconds, such as 2000, or a String that can be parsed into such Integer value.

        Defaults to HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_MASS_INDEXER_PULSE_INTERVAL.

        See Also:
        Constant Field Values
      • COORDINATION_MASS_INDEXER_PULSE_EXPIRATION

        public static final String COORDINATION_MASS_INDEXER_PULSE_EXPIRATION
        How long, in milliseconds, a mass indexer agent "pulse" remains valid before considering the agent disconnected and forcibly removing it from the cluster.

        Only available when HibernateOrmMapperSettings.COORDINATION_STRATEGY is "outbox-polling".

        Every agent registers itself in a database table. Regularly, while polling for events to process, each agent performs a "pulse": it pauses what it was doing and (among other things) updates its entry in the table, to let other agents know it's still alive and prevent an expiration. If an agent fails to update its entry for longer than the value of the expiration interval, it will be considered disconnected: other agents will forcibly remove its entry from the table, and will resume their work as if the expired agent didn't exist.

        The expiration interval must be set to a value at least 3 times larger than the pulse interval:

        • Low values (closer to the pulse interval) mean less time wasted with event processors not processing events when a mass indexer agent terminates due to a crash, but increased risk of event processors starting to process events again during mass indexing because a mass indexer agent is incorrectly considered disconnected.
        • High values (much larger than the pulse interval) mean more time wasted with event processors not processing events when a mass indexer agent terminates due to a crash, but reduced risk of event processors starting to process events again during mass indexing because a mass indexer agent is incorrectly considered disconnected.

        Expects a positive Integer value in milliseconds, such as 30000, or a String that can be parsed into such Integer value.

        Defaults to HibernateOrmMapperOutboxPollingSettings.Defaults.COORDINATION_MASS_INDEXER_PULSE_EXPIRATION.

        See Also:
        Constant Field Values