Hi if it helps:
@ApplicationScoped public class CamelLifecycle { void onStart(@Observes @Initialized(ApplicationScoped.class) final object start) { /* do init camel, new DefaultCamelContext() etc */ } @PreDestroy void destroy() { /* destroy/stop the context */ } } Then it depends the programming model you want, you can use @Inject @Any Instance<RoutesBuilder> routes; and register them all on the context you created or just do it programmatically depending if you need a generic solution, injections etc... Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> Le mer. 14 févr. 2024 à 13:58, Claus Ibsen <claus.ib...@gmail.com> a écrit : > Hi > > Try to search for something like cdi startup listener > There is some @Oberservation annotation where you can specify on startup / > shutdown, and have CDI invoke your methods. > > > On Wed, Feb 14, 2024 at 11:25 AM Jad Anouti <jadanouti...@gmail.com> > wrote: > > > Interesting, I have 2 followup points from that. > > > > Point 1: I was watching a presentation video from my senior developer on > > the product I'm working on which is using camel. And he was saying that > > camel would natively support CDI In the newer version, so the need for > the > > camel-cdi dependency would no longer be needed. From your response this > > statement seems to be incorrect and Camel no longer supports java CDI. > The > > only 2 official ways of support is either spring boot or quarkus > > > > Point 2: Do you have any ideas or examples of how I could possibly > control > > the startup and shutdown of the camel context using CDI ( more > specifically > > Weld but any CDI implementation would do ) > > > > > > On Wed, 14 Feb 2024, 12:16 pm Claus Ibsen, <claus.ib...@gmail.com> > wrote: > > > > > Hi > > > > > > camel-cdi is no longer supported and there is no plan. > > > You can with CDI have some way of startup listeners where you can > create > > > Camel and load routes and whatnot, you may need. > > > > > > > > > > > > On Wed, Feb 14, 2024 at 11:11 AM Jad Anouti <jadanouti...@gmail.com> > > > wrote: > > > > > > > Hello > > > > > > > > I have a question regarding the deprecation of camel CDI > > > > It seems that with the release of Camel 4 the dependency for Camel > CDI > > > has > > > > been removed. > > > > > > > > I was wondering if that means that i will no longer be able to use > > Camel > > > in > > > > my Weld CDI application (Weld being a reference implementation of > Java > > > EE), > > > > or is there an alternative to still be able to use Camel and Weld CDI > > > > together without the need for Camel-cdi. > > > > > > > > Since my tech stack is centered around Java EE, if I were to switch > to > > > > camel-spring-boot I would have to migrate from Weld to spring boot. > And > > > my > > > > company would realistically not allow me to switch to camel-quarkus, > > > since > > > > quarkus is not used in the application. > > > > > > > > Thank you for your assistance in this matter > > > > > > > > Regards > > > > > > > > Jad anouti > > > > > > > > > > > > > -- > > > Claus Ibsen > > > ----------------- > > > @davsclaus > > > Camel in Action 2: https://www.manning.com/ibsen2 > > > > > > > > -- > Claus Ibsen > ----------------- > @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 >