Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update to Spring-Zeebe 8.2 and to connectors-bundle 1.18 #180

Merged
merged 3 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<zeeqs.version>2.9.0</zeeqs.version>
<eze.version>1.2.0</eze.version>
<hazelcast.version>1.4.0</hazelcast.version>
<spring-zeebe.version>8.1.17</spring-zeebe.version>
<camunda-connector-bundle.version>0.17.0</camunda-connector-bundle.version>
<spring-zeebe.version>8.2.0</spring-zeebe.version>
<camunda-connector-bundle.version>0.18.0</camunda-connector-bundle.version>
<camunda-connector-sdk.version>0.8.1</camunda-connector-sdk.version>

<kotlin.version>1.8.20</kotlin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ zeebe:
engine: embedded

client:

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ApplicationTests(

@Test
fun `should start application`() {
assertThat(mainView).isNotNull();
assertThat(mainView).isNotNull()
}

}