0 Replies Latest reply on Jan 19, 2017 6:54 AM by Jay Saradhi

    Camel body getting lost when you enable DEBUG in KARAF 2.4.0.redhat-621159 (jboss-fuse-6.2.1.redhat-159)

    Jay Saradhi Newbie

      Hi,

      I have seen a strange issue today in jboss fuse - When you set the log to DEBUG (log:set DEBUG) in karaf container and run a camel application the body is getting lost (returning empty). certainly i am getting this issue in all the previous versions of fuse as well.

       

      Unable to figure out what issue may be  (suspecting a tracer interceptors when you enable debug on root level). - All working OK if you set the log level to INFO.

       

      Here is my sample code.

       

      explanation of code: I have a rest service exposed to outside. when the service is being called i am checking few things to determine which service provider to be called.

      from direct VM and calling the third party service. thats it and it is very simple code. (exception handling is being covered and not been displayed here)

       

      Can anyone shed their views about the issue please?

       

      <camelContext trace="false" id="my-app-camel-context" streamCache="true"
          useMDCLogging="true" xmlns="http://camel.apache.org/schema/spring"
          xmlns:app="http://myapp.com/integration/service/app/gateway/api">
          
           <properties>

          <!-- disabled the cache spool to disk as we wanted the whole payload to be in memory as payload is huge -->
               <property key="CamelCachedOutputStreamThreshold" value="-1"/>
           </properties>
          
           <propertyPlaceholder id="camelProps" location="ref:props"/>
          
           <route id="my.app.gateway">
               <from uri="cxfrs:bean:myAppGateway?bindingStyle=SimpleConsumer"/>
              
               <choice>
                   <when>
                       <simple>${header.myAppPayloadType} == null</simple>
                       <setHeader headerName="myAppPayloadType">
                           <xpath resultType="java.lang.String">/app:appRequest/myAppPayloadType/text()</xpath>
                       </setHeader>
                       <setHeader headerName="myAppContextName">
                           <xpath resultType="java.lang.String">/app:appRequest/myAppContextName/text()</xpath>
                       </setHeader>
                       <setBody>
                           <xpath>/app:appRequest/payload/child::*</xpath>
                       </setBody>
                   </when>
               </choice>
              
               <log loggingLevel="INFO" message="Received app request for: ${header.myAppPayloadType}"/>
               <convertBodyTo type="java.lang.String"/>
              
               <setHeader headerName="Content-Length">
                   <simple>${body.length}</simple>
               </setHeader>
              
               <routingSlip>
                   <simple>direct-vm:app.provider.${header.myAppPayloadType}</simple>
               </routingSlip>
              
               <removeHeaders pattern="*"/>
              
               <convertBodyTo type="java.io.InputStream"/>
           </route>
          
          
           <route id="app.service.provider.route">
               <from uri="direct-vm:app.provider.XYZ"/>
               <choice>
                   <when>
                       <simple>${header.myAppContextName} != null</simple>
                       <routingSlip>
                           <simple>{{THIRDPARTY_WEBSERVICE}}?bridgeEndpoint=true</simple> <!-- response message from third party getting lost when DEBUG enabled in karaf but response displaying in logs-->
                       </routingSlip>
                   </when>
               </choice>
           </route>
          
      </camelContext>

       

      Message was edited by: Jay Saradhi