From ed45221cd41636d78ea4990644ba185ca925b993 Mon Sep 17 00:00:00 2001 From: Philipp Ossler Date: Tue, 11 Apr 2023 06:14:16 +0200 Subject: [PATCH 1/3] deps: dump spring-zeebe and connectors-bundle --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bc1631b..afd91b1 100644 --- a/pom.xml +++ b/pom.xml @@ -23,8 +23,8 @@ 2.9.0 1.2.0 1.4.0 - 8.1.17 - 0.17.0 + 8.2.0 + 0.18.0 0.8.1 1.8.20 From 0a72cc4325e2783d6c471efd552678c114acf6f6 Mon Sep 17 00:00:00 2001 From: Philipp Ossler Date: Tue, 11 Apr 2023 06:15:09 +0200 Subject: [PATCH 2/3] fix: disable spring-zeebe client Disable the Spring-Zeebe client initialization to avoid configuration issues with the embedded engine. Instead, initialize the client directly using the Spring-Zeebe config. --- .../community/zeebe/play/ZeebePlayApplication.kt | 5 ++++- .../zeebe/play/connectors/ConnectorsConfig.kt | 8 -------- .../zeebe/play/zeebe/RemoteZeebeConfig.kt | 16 +++++++++++++--- src/main/resources/application.yml | 1 - 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt b/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt index 41286ed..8af8e9a 100644 --- a/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt +++ b/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt @@ -39,6 +39,9 @@ open class ZeebePlayApplication( } fun main(args: Array) { - runApplication(*args) + runApplication(*args) { + // Disable the Zeebe-Spring client to avoid configuration issues with the embedded engine. + setDefaultProperties(mapOf("zeebe.client.enabled" to "false")) + } } diff --git a/src/main/kotlin/org/camunda/community/zeebe/play/connectors/ConnectorsConfig.kt b/src/main/kotlin/org/camunda/community/zeebe/play/connectors/ConnectorsConfig.kt index 4f3fb2f..a36ebce 100644 --- a/src/main/kotlin/org/camunda/community/zeebe/play/connectors/ConnectorsConfig.kt +++ b/src/main/kotlin/org/camunda/community/zeebe/play/connectors/ConnectorsConfig.kt @@ -4,7 +4,6 @@ import io.camunda.connector.api.secret.SecretProvider import io.camunda.connector.runtime.util.ConnectorHelper import io.camunda.connector.runtime.util.outbound.ConnectorJobHandler import io.camunda.zeebe.client.ZeebeClient -import io.camunda.zeebe.spring.client.lifecycle.ZeebeClientLifecycle import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.domain.EntityScan import org.springframework.boot.context.properties.EnableConfigurationProperties @@ -28,13 +27,6 @@ class ConnectorsConfig( @PostConstruct fun startConnectors() { - if (zeebeClient is ZeebeClientLifecycle) { - // The connectors are managed by the Spring Zeebe client itself. - // Currently, it is not possible to disable the connectors. See - // https://github.com/camunda-community-hub/spring-zeebe/issues/325. - return - } - if (connectorProperties.mode == ConnectorProperties.ConnectorsMode.ACTIVE) { // start all connectors connectorService diff --git a/src/main/kotlin/org/camunda/community/zeebe/play/zeebe/RemoteZeebeConfig.kt b/src/main/kotlin/org/camunda/community/zeebe/play/zeebe/RemoteZeebeConfig.kt index 685324a..8883cb4 100644 --- a/src/main/kotlin/org/camunda/community/zeebe/play/zeebe/RemoteZeebeConfig.kt +++ b/src/main/kotlin/org/camunda/community/zeebe/play/zeebe/RemoteZeebeConfig.kt @@ -3,10 +3,12 @@ package org.camunda.community.zeebe.play.zeebe import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.KotlinModule import com.fasterxml.jackson.module.kotlin.readValue -import io.camunda.zeebe.spring.client.EnableZeebeClient +import io.camunda.zeebe.client.ZeebeClient +import io.camunda.zeebe.spring.client.properties.ZeebeClientConfigurationProperties import org.camunda.community.zeebe.play.rest.ZeebeServiceException import org.springframework.beans.factory.annotation.Value 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.Configuration import java.net.URI @@ -18,7 +20,7 @@ import java.time.Instant @Configuration @ConditionalOnProperty(name = ["zeebe.engine"], havingValue = "remote") -@EnableZeebeClient +@EnableConfigurationProperties(ZeebeClientConfigurationProperties::class) open class RemoteZeebeConfig { @Value(value = "\${zeebe.clock.endpoint}") @@ -29,6 +31,13 @@ open class RemoteZeebeConfig { return RemoteZeebeService(zeebeClockEndpoint) } + @Bean + fun zeebeClient(config: ZeebeClientConfigurationProperties): ZeebeClient { + // The Spring-Zeebe client is disabled (configuration issues with embedded engine). + // Create the Zeebe client directly using the configuration from Spring-Zeebe. + return ZeebeClient.newClient(config) + } + class RemoteZeebeService(val clockEndpoint: String) : ZeebeService { private val httpClient = HttpClient.newHttpClient() @@ -57,7 +66,8 @@ open class RemoteZeebeConfig { override fun increaseTime(duration: Duration): Long { val offsetMilli = duration.toMillis() - val requestBody = HttpRequest.BodyPublishers.ofString("""{ "offsetMilli": $offsetMilli }""") + val requestBody = + HttpRequest.BodyPublishers.ofString("""{ "offsetMilli": $offsetMilli }""") val clockResponse = sendRequest( request = HttpRequest.newBuilder() diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8a4afa3..b747088 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,7 +7,6 @@ zeebe: engine: embedded client: - broker.gatewayAddress: 127.0.0.1:26500 security.plaintext: true From 1da46b3be06e2eee1dd7b1ffec11691ab10ef564 Mon Sep 17 00:00:00 2001 From: Philipp Ossler Date: Mon, 17 Apr 2023 05:54:16 +0200 Subject: [PATCH 3/3] test: fix config issue in test cases --- .../org/camunda/community/zeebe/play/ZeebePlayApplication.kt | 5 +---- src/main/resources/application.yml | 3 +++ .../org/camunda/community/zeebe/play/ApplicationTests.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt b/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt index 8af8e9a..41286ed 100644 --- a/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt +++ b/src/main/kotlin/org/camunda/community/zeebe/play/ZeebePlayApplication.kt @@ -39,9 +39,6 @@ open class ZeebePlayApplication( } fun main(args: Array) { - runApplication(*args) { - // Disable the Zeebe-Spring client to avoid configuration issues with the embedded engine. - setDefaultProperties(mapOf("zeebe.client.enabled" to "false")) - } + runApplication(*args) } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b747088..5fa1a9e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -10,6 +10,9 @@ zeebe: broker.gatewayAddress: 127.0.0.1:26500 security.plaintext: true + # Disable the Zeebe-Spring client to avoid configuration issues with the embedded engine. + enabled: false + worker: hazelcast: connection: localhost:5701 diff --git a/src/test/kotlin/org/camunda/community/zeebe/play/ApplicationTests.kt b/src/test/kotlin/org/camunda/community/zeebe/play/ApplicationTests.kt index 8094188..9d95d3c 100644 --- a/src/test/kotlin/org/camunda/community/zeebe/play/ApplicationTests.kt +++ b/src/test/kotlin/org/camunda/community/zeebe/play/ApplicationTests.kt @@ -17,7 +17,7 @@ class ApplicationTests( @Test fun `should start application`() { - assertThat(mainView).isNotNull(); + assertThat(mainView).isNotNull() } }