Skip to content

Latest commit

 

History

History

core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Connector Core

The foundation for re-usable Connector functionality.

Example

Outbound Connector

An outbound Connector implements OutboundConnectorFunction#execute(OutboundConnectorContext) to define the connector logic.

@OutboundConnector(
    name = "PING",
    inputVariables = {"caller"},
    type = "io.camunda.example.PingConnector:1"
)
public class PingConnector implements OutboundConnectorFunction {

  @Override
  public Object execute(OutboundConnectorContext context) throws Exception {
    var request = context.bindVariables(PingRequest.class);
    var caller = request.getCaller();
    return new PingResponse("Pong to " + caller);
  }
}

Inbound Connector

An inbound Connector implements InboundConnectorExecutable#activate(InboundConnectorContext) and InboundConnectorExecutable#deactivate() to define the connector logic.

@InboundConnector(
    name = "SUBSCRIPTION",
    type = "io.camunda.example.SubscriptionConnector:1"
)
public class SubscriptionConnector implements InboundConnectorExecutable {

  private MockSubscription subscription; // imitates some real-world subscription

  @Override
  public void activate(InboundConnectorContext context) throws Exception {

    var properties = context.bindProperties(SubscriptionProperties.class);

    // subscribe to events
    subscription = new MockSubscription(properties.getTopic());
    subscription.subscribe(event -> {
      var result = context.correlateWithResult(event);
      // handleResult(result);
    });
  }

  @Override
  public void deactivate() throws Exception {
    // unsubscribe from events
    subscription.shutdown();
  }
}

Connector discovery

Connectors expose themselves as a OutboundConnectorFunction or InboundConnectorExecutable SPI implementations.

Connector runtimes like Spring Zeebe wrap the function to execute it in various environments.

Build

mvn clean package