You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Sahith Paidi <sp...@opentext.com.INVALID> on 2022/05/30 11:24:03 UTC

Query related to camel migration

Hi,

We are upgrading the camel version from 2.25.4 to 3.4.0 in our product, we use java based configuration to configure the camel in our spring application (not spring boot).


We have our custom CamelServletContextListener which extends SimpleCamelServletContextListener

Like below:

         public class AWGCamelServletContextListener extends SimpleCamelServletContextListener {

                  @Override

                  protected SimpleRegistry createRegistry() throws Exception {

                            return SpringHelper.getBean("awgCamelRegistry", SimpleRegistry.class);

                   }

           }


And custom routebuilder to configure the routes for the camel


            @Component

            public class CamelRouteBuilder extends RouteBuilder {

                @Override

                 public void configure() throws Exception {

                 //Our code

                }

            }


We are adding an entry to web.xml to initialize the custom SimpleCamelServletContextListener as follows:

          <listener>

                 <listener-class>com.otag.camel.AWGCamelServletContextListener</listener-class>

           </listener>



Since the SimpleCamelServletContextListener is deprecated from camel2.x

We are trying to achieve the functionality using springcamelContext.


           public class AWGCamelServletContextListener extends SpringCamelContext {

                @Override

                protected DefaultRegistry createRegistry(){

                       return SpringHelper.getBean("awgCamelRegistry", DefaultRegistry.class);

                }


           }


But not able to instantiate the CamelServletContextListener to init the camelContext.

As we are using spring (not spring boot) can you please provide some pointers how to instantiate springcamelContext using spring?



Regards,

Sahith.​