flowable/flowable-engine · error · FlowableException

Consumer already defined for ${endpointUri}!

Error message

Consumer already defined for ${endpointUri}!

What it means

FlowableEndpoint.addConsumer registers the single FlowableConsumer allowed per endpoint. Flowable throws this FlowableException when a second consumer tries to attach while one is already registered, because a flowable endpoint may only feed one route/processor.

Source

Thrown at modules/flowable-camel/src/main/java/org/flowable/camel/FlowableEndpoint.java:101

    @Override
    public Producer createProducer() throws Exception {
        FlowableProducer producer = new FlowableProducer(this, getTimeout(), getTimeResolution());
        producer.setRuntimeService(runtimeService);
        producer.setIdentityService(identityService);
        producer.setRepositoryService(repositoryService);
        producer.setManagementService(managementService);
        return producer;
    }

    @Override
    public Consumer createConsumer(Processor processor) throws Exception {
        return new FlowableConsumer(this, processor);
    }

    protected void addConsumer(FlowableConsumer consumer) {
        if (flowableConsumer != null) {
            throw new FlowableException("Consumer already defined for " + getEndpointUri() + "!");
        }
        flowableConsumer = consumer;
    }

    protected void removeConsumer() {
        flowableConsumer = null;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    public void setIdentityService(IdentityService identityService) {
        this.identityService = identityService;
    }

    public void setRuntimeService(RuntimeService runtimeService) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Remove the duplicate route consuming the same flowable URI; only one route per URI is allowed.
  2. Ensure the previous consumer is stopped (which calls removeConsumer) before starting a new one.
  3. Use distinct flowable endpoint URIs (different processDefinitionKey) for different routes.
  4. If a stale consumer remains, restart the CamelContext to clear endpoint state.

Example fix

// before
from("flowable:myProcess").to("direct:a");
from("flowable:myProcess").to("direct:b"); // second consumer
// after
from("flowable:myProcess").to("direct:a");
from("flowable:otherProcess").to("direct:b");
Defensive patterns

Strategy: validation

Validate before calling

long consumers = camelContext.getRoutes().stream()
    .filter(r -> "flowable:myProcess".equals(r.getEndpoint().getEndpointUri()))
    .count();
if (consumers > 0) {
    throw new IllegalStateException("Route for flowable:myProcess already exists");
}

Try / catch

try {
    camelContext.addRoutes(myRouteBuilder);
} catch (FlowableException e) {
    if (e.getMessage().contains("Consumer already defined")) {
        // skip duplicate registration or stop existing route first
    }
}

Prevention

When it happens

Trigger: Starting two Camel routes with the same from("flowable:xxx") URI; re-deploying/starting a route without the old one being stopped (removeConsumer not called); duplicating the endpoint definition across route builder instances.

Common situations: Route auto-restart or hot redeploy adding a second consumer; copy-pasted route definitions with identical flowable URIs; multiple CamelContexts sharing the same endpoint URI string in the same context.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/5825b0ae4742afb0. Report an issue: GitHub.