Skip to content

Latest commit

 

History

History
95 lines (77 loc) · 2.75 KB

README.md

File metadata and controls

95 lines (77 loc) · 2.75 KB

camunda-delegator-lib

Features

  • Declarative style for delegate code
  • Generated delegates documentation and templates for camunda modeler(this feature is not production ready)
  • Compatibility with JavaDelegate

Requirements

  1. Project complied with Camunda version 7.17 - minimum supported version
  2. Spring Boot 2.6.4
  3. Kotlin version 1.7.10

Installation

Add dependency in gradle

implementation(group = "ru.tinkoff.top", name = "camunda-delegator-spring-boot-starter", version = "version")

Activate library by camunda plugin DelegatorBpmnParserCamundaPlugin with other plugins

    @Bean
    fun processEngineConfiguration(
        processEnginePlugins: List<ProcessEnginePlugin>
    ): SpringProcessEngineConfiguration {
        val customEngine = SpringProcessEngineConfiguration()
        return CamundaSpringBootUtil.initCustomFields(customEngine).also {
            it.isJobExecutorActivate = false
            it.processEnginePlugins.add(CompositeProcessEnginePlugin(processEnginePlugins))
        }
    }

or

    @Bean
    fun processEngineConfiguration(
        @Qualifier(DELEGATOR_EXPRESSION_MANAGER)
        delegatorExpressionManager: ExpressionManager,
        @Qualifier(DELEGATOR_BPMN_PARSE_FACTORY)
        delegatorBpmnParseFactory: BpmnParseFactory
    ): SpringProcessEngineConfiguration {
        val customEngine = SpringProcessEngineConfiguration()
        return CamundaSpringBootUtil.initCustomFields(customEngine).also {
            it.isJobExecutorActivate = false
            it.processEnginePlugins.add(
                DelegatorBpmnParserCamundaPlugin(delegatorExpressionManager, delegatorBpmnParseFactory)
            )
        }
    }

Notice

Camunda JobExecutor cannot be activated before application started it fully. Your can activate job executing on event ApplicationStartedEvent(delegators init on this event).

@Component
class JobExecutorActivationListener(
    private val jobExecutor: JobExecutor
) {

    @EventListener(ApplicationStartedEvent::class)
    @Order(DELEGATE_REGISTER_LISTENER_ORDER + 1)
    fun startJobExecution() {
        jobExecutor.start()
    }
}

Example

@CamundaDelegate
class ProductGeneratorDelegate {

    @DelegateExecute
    @SingleResultVariable(name = "product")
    fun generateProduct(
        @Variable(name = "product") product: String
    ): Product {
        return Product(product)
    }
}

Camunda test example

See wiki for more information.

Contacts

p.pletnev@tinkoff.ru