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

io.holunda.camunda.taskpool.enricher.TaskCommandEnricherService.kt Maven / Gradle / Ivy

There is a newer version: 2.1.8
Show newest version
package io.holunda.camunda.taskpool.enricher

import io.holunda.camunda.taskpool.api.task.EngineTaskCommand
import io.holunda.camunda.taskpool.api.task.TaskIdentityWithPayloadAndCorrelations
import io.holunda.camunda.taskpool.sender.CommandSender
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Component

/**
 * Default enricher.
 */
@Component
class TaskCommandEnricherService(
  private val commandSender: CommandSender,
  private val enricher: VariablesEnricher
) {


  @EventListener
  fun send(command: EngineTaskCommand) {
    // enrich before collect
    commandSender.send(enrich(command))
  }

  /**
   * Enriches the command, if possible.
   */
  private fun enrich(command: EngineTaskCommand): EngineTaskCommand = when (command) {
    is TaskIdentityWithPayloadAndCorrelations -> enricher.enrich(command) as EngineTaskCommand
    else -> command
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy