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

com.github.phisgr.gatling.kt.grpc.action.StreamSendBuilder.kt Maven / Gradle / Ivy

The newest version!
package com.github.phisgr.gatling.kt.grpc.action

import io.gatling.commons.util.Clock
import io.gatling.javaapi.core.ActionBuilder
import io.gatling.javaapi.core.Session
import scala.runtime.BoxedUnit
import com.github.phisgr.gatling.grpc.action.StreamSendBuilder as StreamSendBuilderS
import io.gatling.core.action.builder.ActionBuilder as ActionBuilderS

class StreamSendBuilder(@PublishedApi internal val wrapped: StreamSendBuilderS) : ActionBuilder {
    @JvmSynthetic
    inline fun preSendAction(crossinline action: (Clock, Req, Session) -> Unit): StreamSendBuilder =
        StreamSendBuilder(wrapped.preSendAction { clock, req, session ->
            action(clock, req, Session(session))
            BoxedUnit.UNIT
        })

    fun preSendAction(action: PreSendAction): StreamSendBuilder =
        preSendAction { clock, req, session -> action(clock, req, session) }

    override fun asScala(): ActionBuilderS = wrapped
}

@FunctionalInterface // but not Kotlin's `fun interface` because it's for Java
interface PreSendAction {
    operator fun invoke(clock: Clock, req: Req, session: Session)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy