Skip to content

Integration with External Services in BPM

During the scoring process, it is often necessary to access external services: credit bureau checks, anti-fraud systems, data verification, and other checks. BPM provides two main mechanisms for such integration.

Integration Methods

MethodWhen to Use
External Worker TaskSimple checks, polling model, delay is not critical
RPC via KafkaLong operations, asynchronous processing

1. External Worker Task

What is it

External Worker is a mechanism where an external service "fetches" tasks from BPM, executes them, and returns the result. It works like a task queue: the BPMN process creates a task with a specific topic, and your service periodically polls the platform for new tasks.

How it works

How to use in BPMN diagram

In the BPMN diagram, a Service Task with type "external worker" is used:

  1. Add a Service Task to the diagram
  2. Specify the task type: External Worker
  3. Set the Topic — a unique identifier for your service

Topic Format

Recommended format: {project_code}.{action}.{version}

ExampleDescription
myproject.credit-check.v1Credit history check, version 1
myproject.fraud-detection.v2Anti-fraud check, version 2
lending.document-verify.v1Document verification

Data Transfer

  • Input data: process variables are automatically passed to the task
  • Output data: service result is saved to process variables

Result Types

After task execution, the service must return one of three result types:

ResultWhen to UseWhat Happens
successTask completed successfullyProcess continues on the main path
bpmnErrorBusiness error (e.g., client failed verification)Process transitions to error handler (Error Boundary Event)
failTechnical error (service unavailable, timeout)Task will be retried according to retry settings

success — use when the check passed and there is a result (positive or negative). For example: "client found in credit bureau database, credit rating 750".

bpmnError — use for business exceptions that should change the process flow. For example: "client is blacklisted" — the process may transition to the rejection branch. When sending bpmnError, an error code is specified that can be handled in the diagram:

  • Error Boundary Event without code — catches all bpmnError
  • Error Boundary Event with code — catches only errors with the specified code (e.g., BLACKLIST, FRAUD_DETECTED)

fail — use for technical failures when the task needs to be retried. For example: "credit bureau service is unavailable" — the system will retry the request later.

When to use

  • Simple and fast checks (up to several seconds)
  • Service can work in polling mode
  • Small delay between task creation and receipt is acceptable

2. Asynchronous Interaction via Kafka

What is it

RPC via Kafka is a Request/Reply pattern where the BPMN process sends a message to a Kafka topic and waits for a response in another topic. This approach is suitable for long operations and asynchronous processing.

How it works

How to use in BPMN diagram

To implement RPC via Kafka in BPMN, two elements are used:

  1. Send Task — for sending a request to Kafka
  2. Message Catch Event — for waiting for a response

Correlation ID

The key point is linking request and response through Correlation ID. This is a unique identifier (usually the process instance ID) that:

  • Is sent along with the request
  • Is returned along with the response
  • Allows BPM to understand which process the response is addressed to

When to use

  • Long operations (minutes, hours)
  • External service works asynchronously
  • High load and scalability requirements

Comparison of Approaches

CriterionExternal WorkerKafka RPC
Ease of useLowMedium
Interaction modelPollingPub/Sub
LatencyDepends on polling intervalMinimal
Suitable forSimple fast checksLong operations, critical integrations
ScalabilityMediumHigh

Recommendations for Choosing

Use External Worker if:

  • Check executes quickly (seconds)
  • Logic is simple and synchronous
  • You want minimal configuration

Use Kafka RPC if:

  • Operation may take a long time
  • Service needs to handle a large flow of requests
  • Asynchronous architecture is required