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

io.holunda.camunda.datapool.DataEntrySenderConfiguration.kt Maven / Gradle / Ivy

package io.holunda.camunda.datapool

import com.fasterxml.jackson.databind.ObjectMapper
import io.holunda.camunda.datapool.sender.simple.SimpleDataEntryCommandSender
import io.holunda.camunda.taskpool.api.sender.DataEntryCommandSender
import org.axonframework.commandhandling.gateway.CommandGateway
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration

/**
 * Configuration enabled by the property
 */
@ComponentScan
@Configuration
@EnableConfigurationProperties(DataEntrySenderProperties::class)
open class DataEntrySenderConfiguration {

  @Autowired
  lateinit var gateway: CommandGateway

  @Autowired
  lateinit var properties: DataEntrySenderProperties

  @Autowired
  lateinit var objectMapper: ObjectMapper

  @Bean
  @ConditionalOnProperty(name = ["camunda.taskpool.dataentry.sender.type"], havingValue = "simple")
  open fun initSimpleSender(): DataEntryCommandSender {
    return SimpleDataEntryCommandSender(gateway, properties, objectMapper)
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy