Hi Nicolas,

> On 11 May 2016, at 17:02, nicolasduminil 
> <nicolas.dumi...@simplex-software.fr> wrote:
> 
> Hi Antonin,
> 
> I have investigated the direction you've suggested and I think that the (1)
> is fine. Then I found a lot of example like this:
> 
>    CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
>    cdiContainer.boot();
>    ContextControl contextControl = cdiContainer.getContextControl();
>    contextControl.startContext(ApplicationScoped.class);
>    /*
>     * Your code here 
>     */
> 
> But I'm not sure what the code is supposed to do once the container and the
> context started. In my case, the Camel route starts but it stops immediately
> because the JVM exits. I don't know how to tell to the container to run for
> ever.

You have to block the main thread, one way or another, otherwise the JVM exits 
as all the non-daemon threads have returned / died. An alternative to is to use 
Camel Main support (which I realise I forgot to mention) that relies on 
DeltaSpike [2] and that does the blocking for you and register a shutdown hook 
by default. So you can use the org.apache.camel.cdi.Main class which is part of 
the camel-cdi component.

> I have tried also to create an uber jar using the shade maven plugin but I
> cannot run it with java -jar as there is no any main().

You could try using the Main class provided by camel-cdi.

> So I would be very grateful if you could enlighten me. Many thanks in
> advance.

Let us know if you need further help.

> Kind regards,
> 
> Nicolas DUMINIL
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-run-camel-cdi-projects-tp5781727p5782448.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to