Target filter
Search Kotlin docs
  • Platforms
  • Tealium Prism Kotlin
core/com.tealium.prism.core.api.barriers/Barriers/batching

batching

@JvmOverloads
fun batching(enforcedSettings: (BatchingBarrierSettingsBuilder) -> BatchingBarrierSettingsBuilder? = { it }): BarrierFactory

Returns the BarrierFactory for creating the "BatchingBarrier". Use this barrier to only dispatch events when a certain number of queued events has been reached for any of the Dispatcher in scope.

When the BatchingBarrier is auto-registered from BarrierRegistry, it is not scoped to any module and is therefore inactive until scopes are provided via local or remote settings.

When you explicitly add this barrier using the helper below, the created BatchingBarrier will always have its default scope set to the Collect dispatcher at the factory level:

config.addBarrier(Barriers.batching())
Content copied to clipboard

This default Collect scope can be overridden (or cleared to deactivate the barrier) using enforced settings, local settings, or remote settings configuration.

Example of programmatic approach to override the default scope via enforced settings:

config.addBarrier(Barriers.batching { enforcedSettings ->
enforcedSettings.setScopes(setOf(BarrierScope.Dispatcher("MyDispatcher")))
})
Content copied to clipboard

Parameters

enforcedSettings

A function that takes a BatchingBarrierSettingsBuilder and returns a configured builder. Used to provide programmatic settings that will be enforced and remain constant during the lifecycle of the Barrier. Other settings will still be affected by Local and Remote settings and updates.

Generated by Dokka
(c) Tealium 2026