Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10964

CXF http-jetty transport reverse proxy configuration will not work when using @BeanInject in RouteBuilder bean

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.18.2
    • 2.19.0
    • camel-blueprint, camel-cxf
    • None

    Description

      Inside a RouteBuilder another bean is injected from registry using @BeanInject:

      public class GreeterBuilder extends RouteBuilder {
      
          @BeanInject
          Configuration configuration;
      
          @Override
          public void configure() throws Exception {
              from("cxf:bean:routerEndpoint")
                  ...
          }
      ...
      

      CXF http-jetty transport is configured with reverse proxy inside blueprint context like this:

      <blueprint ...>
        <httpj:engine-factory bus="cxf">
          <httpj:engine port="7771">
            <httpj:connector>
              <bean id="connector" class="org.eclipse.jetty.server.ServerConnector">
                <argument ref="server" />
                <argument>
                  <array>
                    <ref component-id="httpConnectionFactory" />
                  </array>
                </argument>
                <property name="port" value="7771" />
              </bean>
            </httpj:connector>
          </httpj:engine>
        </httpj:engine-factory>
      
        <bean id="server" class="org.eclipse.jetty.server.Server" />
      
        <bean id="httpConfiguration" class="org.eclipse.jetty.server.HttpConfiguration">
          <property name="customizers">
            <list>
              <bean class="org.eclipse.jetty.server.ForwardedRequestCustomizer" />
            </list>
          </property>
        </bean>
      
        <bean id="httpConnectionFactory" class="org.eclipse.jetty.server.HttpConnectionFactory">
          <argument ref="httpConfiguration" />
        </bean>
        ...
      

      However, the reverse proxy won't work as long as @BeanInject is present in the RouteBuilder bean.

      The root cause is that the camel-blueprint's CamelInjector triggers earlier startup of the blueprint Camel context before the route is fully up, so the http-jetty transport configuration is not correctly connected to the CXF endpoint.

      Attachments

        Issue Links

          Activity

            People

              tadayosi Tadayoshi Sato
              tadayosi Tadayoshi Sato
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: