All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lemfi.kest.cadence.builder.ActivityCallExecutionBuilder.kt Maven / Gradle / Ivy

There is a newer version: 0.8.1
Show newest version
package com.github.lemfi.kest.cadence.builder

import com.github.lemfi.kest.cadence.executor.ActivityExecution
import com.github.lemfi.kest.cadence.model.cadenceProperty
import com.github.lemfi.kest.core.builder.ExecutionBuilder
import com.github.lemfi.kest.core.model.Execution
import com.uber.cadence.context.ContextPropagator
import kotlin.properties.Delegates
import kotlin.reflect.KFunction

class ActivityCallExecutionBuilder(private val cls: Class): ExecutionBuilder() {

    lateinit var domain: String
    lateinit var tasklist: String

    lateinit private var activity: KFunction
    private var params: Array? = null
    private var contextPropagators: List? = null

    var host = cadenceProperty { host }
    var port = cadenceProperty { port }

    private var withResult: RESULT.()->Unit = {}

    fun activity(activity: KFunction, vararg parameters: Any?) {
        this.activity = activity
        this.params = parameters
    }

    fun contextPropagators(vararg contextPropagators: ContextPropagator?) {
        this.params = contextPropagators
    }

    fun withResult(l: RESULT.()->Unit) { withResult = l }

    override fun build(): Execution {
        return ActivityExecution(
                host, port, domain, tasklist, cls, activity, params, contextPropagators, withResult
        )
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy