Configuring Connectors
The connectors available to Connect may not always suit your needs. Sometimes,it is necessary to provide configuration.
To configure a connector detected by Spin, the SPIorg.camunda.connect.spi.ConnectorConfigurator
can be implemented. Aconfigurator specifies which classes it can configure. Connect discovers aconfigurator by employing Java’s service loader mechanism and will then provideit with all connectors that match the specified class (or are a subclassthereof). The concrete configuration options depend on the actual connector.For example, the HTTP based connector can modify the Apache HTTP clientthat the connector uses.
To provide a custom configurator, you have to
- Provide a custom implementation of org.camunda.connect.spi.ConnectorConfigurator
- Add the configurator’s fully qualified classname to a file named META-INF/services/org.camunda.connect.spi.ConnectorConfigurator
- Ensure that the artifact containing the configurator is reachable from Connect’s classloader
Custom Connector
A connector is an implementation of the interfaceorg.camunda.connect.spi.Connector
. An implementation of this interface can beregistered by implementing the SPI org.camunda.connect.spi.ConnectorProvider
.Connect uses the Java platform’s service loader mechanism to lookup providerimplementations at runtime.
To provide a custom connector, you have to
- Provide a custom implementation of org.camunda.connect.spi.Connector
- Provide a custom implementation of org.camunda.connect.spi.ConnectorProvider
- Add the provider’s fully qualified classname to a file named META-INF/services/org.camunda.connect.spi.ConnectorProvider
- Ensure that the artifact containing the provider is reachable from Connect’s classloader
If you now callorg.camunda.connect.Connectors.getAvailableConnectors()
, thenthe custom connector is returned along with the built-in connectors.Furthermore,org.camunda.connect.Connectors.getConnector(String connectorId)
can be used to explicity retrieve the connector by a specific provider.
原文: https://docs.camunda.org/manual/7.9/reference/connect/extending-connect/