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

chore(deps): bump connector SDK to 8.6 #133

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- connectors version -->
<version.connectors>8.5.2</version.connectors>
<version.connectors>8.6.0-SNAPSHOT</version.connectors>

<!-- external libraries -->
<version.assertj>3.25.3</version.assertj>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package io.camunda.connector.inbound;

import io.camunda.connector.api.annotation.InboundConnector;
import io.camunda.connector.api.inbound.CorrelationFailureHandlingStrategy.ForwardErrorToUpstream;
import io.camunda.connector.api.inbound.CorrelationFailureHandlingStrategy.Ignore;
import io.camunda.connector.api.inbound.CorrelationResult;
import io.camunda.connector.api.inbound.CorrelationResult.Failure;
import io.camunda.connector.api.inbound.CorrelationResult.Success;
import io.camunda.connector.api.inbound.InboundConnectorContext;
import io.camunda.connector.api.inbound.InboundConnectorExecutable;
import io.camunda.connector.inbound.subscription.MockSubscription;
import io.camunda.connector.inbound.subscription.MockSubscriptionEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@InboundConnector(name = "My Inbound Connector", type = "io.camunda:my-inbound-connector:1")
public class MyConnectorExecutable implements InboundConnectorExecutable<InboundConnectorContext> {
Expand All @@ -13,6 +20,8 @@ public class MyConnectorExecutable implements InboundConnectorExecutable<Inbound

private InboundConnectorContext context;

private final static Logger LOG = LoggerFactory.getLogger(MyConnectorExecutable.class);

@Override
public void activate(InboundConnectorContext connectorContext) {
this.context = connectorContext;
Expand All @@ -21,7 +30,26 @@ public void activate(InboundConnectorContext connectorContext) {
}

private void onEvent(MockSubscriptionEvent rawEvent) {
context.correlate(new MyConnectorEvent(rawEvent));
var result = context.correlateWithResult(new MyConnectorEvent(rawEvent));
handleResult(result);
}

private void handleResult(CorrelationResult result) {
switch (result) {
case Success ignored -> LOG.debug("Message correlated successfully");
case Failure failure -> {
switch (failure.handlingStrategy()) {
case ForwardErrorToUpstream ignored -> {
LOG.error("Correlation failed, reason: {}", failure.message());
// forward error to upstream
}
case Ignore ignored -> {
LOG.debug("Correlation failed but no action required, reason: {}", failure.message());
// ignore
}
}
}
}
}

@Override
Expand Down
Loading