apache / apache/camel-quarkus

`FastCamelContext` cannot be restarted after stop

Open
#3,692 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
302
Forks
232
Avg merge
1d 20h
Merged PRs (30d)
114

Description

In a CQ application if you do:

```java
context.stop();
context.start();
```

Then you get:

```
java.lang.UnsupportedOperationException
at org.apache.camel.quarkus.core.FastCamelContext.createRegistry(FastCamelContext.java:84)
at org.apache.camel.impl.engine.AbstractCamelContext.getRegistry(AbstractCamelContext.java:2100)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartStandardServices(AbstractCamelContext.java:3808)
at org.apache.camel.impl.engine.AbstractCamelContext.forceLazyInitialization(AbstractCamelContext.java:3773)
at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2849)
at org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:172)
at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2620)
at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2639)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:255)
```

In general, it's not considered good practice to stop the `CamelContext` and start it again. But with CQ, it's not trivial to support, given that parts of the `CamelContext` are configured at build time, and there's no possibility of repeating those steps at runtime.

Should we detect the restart scenario and throw a friendlier exception? Or is there something else that could be done?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the CQ restart sequence from the issue and read FastCamelContext.java around lines 84 and 172, along with the AbstractCamelContext stack-trace callers. Determine whether restart should be supported or rejected, then verify the chosen behavior and its exception message against the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.