springspring-cloud-streamcamunda

Spring Cloud Stream automatically register MessageChannel for Camunda


Demo project has deps:

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
    </dependencies>

And just run in we can see in logs:

 INFO 75175 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel camundaBpmVersion_integrationflow.channel#0
    INFO 75175 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel errorChannel
    INFO 75175 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel camundaBpmVersion-out-0
   INFO 75175 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel nullChannel
   INFO 75175 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageHandler camundaBpmVersion_integrationflow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0
    INFO 75175 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageHandler _org.springframework.integration.errorLogger
    INFO 75175 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageSource camundaBpmVersion-out-0_spca

How disable auto creating bind for Camunda and registration MessageSource?

But if add any empty consumer, this helps

@Bean
fun test() = Consumer<Any> {}

Solution

  • Try specify property spring.cloud.function.ineligible-definitions=camundaBpmVersion where test is the name of your function.

    Basically your camunda auto-configuration has some functions as beans. Actually one bean, hence it is automatically registered. By adding your hack you creating a second function bean and without spring.cloud.function.definition the framework doesn't know what needs to be registered, so it registers nothing and your hack works. But it's a hack nevertheless. The spring.cloud.function.ineligible-definitions would be the correct way of solving it.