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
- Remove the duplicate route consuming the same flowable URI; only one route per URI is allowed.
- Ensure the previous consumer is stopped (which calls removeConsumer) before starting a new one.
- Use distinct flowable endpoint URIs (different processDefinitionKey) for different routes.
- 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
- Register each flowable consuming route exactly once; guard route builders against re-registration.
- Stop routes properly on shutdown/redeploy so removeConsumer runs.
- Use unique flowable URIs per route.
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
- Endpoint not defined for ${key}
- Initiator header '${processInitiatorHeaderName}': Value must
- Consumer not defined for ${endpointUri}
- error occurred while waiting for activity=${activity} for pr
- Could not find activity ${activity} for processId ${processI
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/5825b0ae4742afb0.
Report an issue: GitHub.