This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.github.avrokotlin.avro4k.Avro | |
import com.github.avrokotlin.avro4k.io.AvroEncodeFormat | |
import io.infinitic.common.tasks.executors.messages.RunTask | |
import kotlinx.serialization.KSerializer | |
import org.apache.avro.file.SeekableByteArrayInput | |
import org.apache.avro.generic.GenericDatumReader | |
import org.apache.avro.generic.GenericRecord | |
import org.apache.avro.io.DecoderFactory | |
import org.apache.pulsar.client.api.Consumer | |
import org.apache.pulsar.client.api.Producer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Serializable | |
sealed class TaskEngineMessage() { | |
abstract val taskId: TaskId | |
} | |
@Serializable | |
data class DispatchTask( | |
override val taskId: TaskId, | |
val taskName: TaskName, | |
val methodName: MethodName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Serializable | |
data class TaskEngineEnvelope( | |
val taskId: TaskId, | |
val type: TaskEngineMessageType, | |
val dispatchTask: DispatchTask? = null, | |
val cancelTask: CancelTask? = null, | |
val taskCanceled: TaskCanceled? = null, | |
val taskCompleted: TaskCompleted? = null, | |
) { | |
init { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typealias TaskEngineMessageToProcess = MessageToProcess<TaskEngineMessage> | |
fun CoroutineScope.startPulsarTaskEngineWorker( | |
taskEngineConsumer: Consumer<TaskEngineEnvelope>, | |
taskEngine: TaskEngine, | |
logChannel: SendChannel<TaskEngineMessageToProcess>?, | |
enginesNumber: Int | |
) = launch(Dispatchers.IO) { | |
val taskInputChannel = Channel<TaskEngineMessageToProcess>() |
OlderNewer