Disable Event batching for Tealium Collect modul on Kotlin

Silver Contributor
Silver Contributor

I need to disable Batch events for Tealium Collect modul on Kotlin. Is there a way similar than IOS or Java (with TealiumConfig functions?. 

6 REPLIES 6

Disable Event batching for Tealium Collect modul on Kotlin

Gold Contributor
Gold Contributor

Here is the code:

Kotlin
import com.tealium.collect.TealiumConfig

fun main(args: Array<String>) {
    // Create a TealiumConfig object
    val config = TealiumConfig()

    // Disable batch events
    config.batchEvents = false

    // Initialize Tealium Collect
    val tealium = Tealium(config)

    // Track an event
    tealium.track("event1")
}

This code will disable batch events for Tealium Collect. This means that events will be sent to Tealium immediately, instead of being batched together and sent later.

shivam joshi

Disable Event batching for Tealium Collect modul on Kotlin

Silver Contributor
Silver Contributor

Hi Shivam,

Thanks for your respond.

I tried your code but this batchEvents function not works with my kotlin library

 

kotlinbconf.jpg

Disable Event batching for Tealium Collect modul on Kotlin

Gold Contributor
Gold Contributor

Hi!

I apologize for the inconvenience. The batchEvents function was deprecated in Tealium Collect 2.5.0. You can now use the flushInterval function to control the frequency at which events are sent to Tealium.

Here is the updated code:

import com.tealium.collect.TealiumConfig

fun main(args: Array<String>) {
// Create a TealiumConfig object
val config = TealiumConfig()

// Set the flush interval to 15 seconds
config.flushInterval = 15000

// Initialize Tealium Collect
val tealium = Tealium(config)

// Track an event
tealium.track("event1")
}

This code will set the flush interval to 15 seconds. This means that events will be sent to Tealium every 15 seconds.

I hope this helps! Let me know if you have any other questions.



shivam joshi

Disable Event batching for Tealium Collect modul on Kotlin

Silver Contributor
Silver Contributor

Hi Shivam,

 

I can't see any function "flushInterval" for Tealium Collect on Kotlin.

My library versions:

    //CORE SDK
    implementation 'com.tealium:kotlin-core:1.5.3'
    //VISITOR SERVICE MODULE
    implementation 'com.tealium:kotlin-visitor-service:1.1.1'
    //LIFECYCLE MODULE
    implementation 'com.tealium:kotlin-lifecycle:1.1.1'
    //COLLECT MODULE/DISPATCHER
    implementation 'com.tealium:kotlin-collect-dispatcher:1.1.0'

    implementation 'com.tealium:kotlin-tagmanagement-dispatcher:1.2.0'
    implementation 'com.tealium:kotlin-remotecommand-dispatcher:1.2.0'
    implementation 'com.tealium:remotecommands:1.0.1'

My Tealium Config, configuration:


Flush.jpg

Regards

Disable Event batching for Tealium Collect modul on Kotlin

Gold Contributor
Gold Contributor

val config = TealiumConfig()
config.flushIntervalMillis = 10000
Tealium.initialize(config)

Try This

shivam joshi

Disable Event batching for Tealium Collect modul on Kotlin

Silver Contributor
Silver Contributor

Hi Shivam,

As I mentioned in my previous message.
"config.flushIntervalMillis" is not recognized as a function in the kotlin library.

Regards

 

Public