Skip to content

Commit

Permalink
Merge pull request #154 from camunda-community-hub/dump-connectors
Browse files Browse the repository at this point in the history
Dump connectors from 0.16.1 to 0.17.0
  • Loading branch information
saig0 authored Mar 14, 2023
2 parents 2680ef8 + 8416a64 commit 4c955fa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<eze.version>1.2.0-alpha2</eze.version>
<hazelcast.version>1.4.0-alpha1</hazelcast.version>
<spring-zeebe.version>8.1.17</spring-zeebe.version>
<camunda-connector-bundle.version>0.16.1</camunda-connector-bundle.version>
<camunda-connector-sdk.version>0.6.0</camunda-connector-sdk.version>
<camunda-connector-bundle.version>0.17.0</camunda-connector-bundle.version>
<camunda-connector-sdk.version>0.7.0</camunda-connector-sdk.version>

<kotlin.version>1.8.10</kotlin.version>
<spring.boot.version>2.7.8</spring.boot.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.camunda.community.zeebe.play.connectors

import io.camunda.connector.impl.outbound.OutboundConnectorConfiguration
import io.camunda.connector.runtime.util.outbound.OutboundConnectorRegistrationHelper
import io.camunda.connector.runtime.util.discovery.SPIConnectorDiscovery
import io.camunda.zeebe.model.bpmn.Bpmn
import io.camunda.zeebe.model.bpmn.BpmnModelInstance
import io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeInput
Expand Down Expand Up @@ -55,9 +55,7 @@ class ConnectorService(
}

fun findAvailableConnectors(): List<OutboundConnectorConfiguration> {
return OutboundConnectorRegistrationHelper
.parseFromSPI()
.toList()
return SPIConnectorDiscovery.discoverOutbound().toList()
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.camunda.community.zeebe.play.connectors

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
Expand Down Expand Up @@ -39,10 +40,14 @@ class ConnectorsConfig(
connectorService
.findAvailableConnectors()
.forEach { connectorConfig ->
val connector =
ConnectorHelper.instantiateConnector(connectorConfig.connectorClass)
val jobHandler = ConnectorJobHandler(connector, secretProvider)

zeebeClient
.newWorker()
.jobType(connectorConfig.type)
.handler(ConnectorJobHandler(connectorConfig.function, secretProvider))
.handler(jobHandler)
.name(connectorConfig.name)
.fetchVariables(connectorConfig.inputVariables.toList())
.open()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.camunda.community.zeebe.play.rest

import io.camunda.connector.impl.outbound.OutboundConnectorConfiguration
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.client.api.response.ActivatedJob
Expand Down Expand Up @@ -35,7 +36,8 @@ class ConnectorsResource(
.find { it.type == jobType }
?: throw RuntimeException("No connector found with job type '$jobType'."))

val jobHandler = ConnectorJobHandler(connectorConfig.function, connectorsSecretProvider)
val connector = ConnectorHelper.instantiateConnector(connectorConfig.connectorClass)
val jobHandler = ConnectorJobHandler(connector, connectorsSecretProvider)

findConnectorJob(connectorConfig, jobKey)
?.let { jobHandler.handle(zeebeClient, it) }
Expand Down

0 comments on commit 4c955fa

Please sign in to comment.