You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Aa S <aw...@gmail.com> on 2021/04/29 14:08:45 UTC

Fwd: Retry NoHttpResponseException

Hi ,
   I have this situation where I get two variations of a
org.apache.http.NoHttpResponseException
, extract from logs ,

   1. I/O exception (org.apache.http.NoHttpResponseException) caught when
   processing request to {s}->https://XYX.com:443: The target server failed
   to respond    this exception is handled by retrying the http request by
   (org.apache.http.impl.execchain.RetryExec) and the retry is successful 100%
   of the time. No issues here.
   2. Log99 org.apache.http.NoHttpResponseException: XYX:443 failed to
   respond XYX.com:443 failed to respond while processing
<mon><us>5679</us></mon>
   this exception NOT tried again  like (1) and fails hence we have
   discrepancies between two systems.  This exception is handled by the
   java.lang.Exception exception handler in the blueprint below.

My question is

   - What is the difference between the two, while the (1) gets retired and
   the (2) does not?
   - What  do I need to make so that the http request is  tried once again
   by camel for (2) as it does for (1) .

Any pointers will be appreciated.

regards
--AS
Note: This happens for around 2% of all the PUT/POST requests to the target
server.

<?xml version="1.0" encoding="UTF-8"?><blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">
  <bean class="org.apache.http.impl.conn.PoolingHttpClientConnectionManager"
id="connManager">
    <property name="maxTotal" value="1000"/>
    <property name="defaultMaxPerRoute" value="50"/>
    <property name="validateAfterInactivity" value="5000"/>
  </bean>
  <camelContext xmlns="http://camel.apache.org/schema/blueprint"
id="sdvi-to-bebanjo-context" useMDCLogging="true">
    <threadPoolProfile id="splitterThreadPool" maxPoolSize="4"
maxQueueSize="-1" poolSize="4"/>
    <route id="consumer">
      <from id="_from1"
uri="aws-sqs://{{SQSQueue}}?accessKey={{accesskey}}&amp;secretKey=RAW({{secretkey}})&amp;attributeNames=SenderId,SentTimestamp,ApproximateFirstReceiveTimestamp"/>
      <when id="_when1">
        <jsonpath>.Type == 'Movie'</jsonpath>
        <setBody id="_setBody1">
          <simple>${exchangeProperty.inbound_payload}</simple>
        </setBody>
        <transform id="_transform1">
          <jsonpath resultType="java.util.List">.data</jsonpath>
        </transform>
        <split executorServiceRef="splitterThreadPool" id="_split1">
          <simple>${body}</simple>
          <split executorServiceRef="splitterThreadPool" id="_split2">
            <simple>${body}</simple>
            <setHeader headerName="CamelHttpMethod" id="_setHeader2">
              <constant>PUT</constant>
            </setHeader>
            <setHeader headerName="Content-Type" id="_setHeader3">
              <constant>application/xml</constant>
            </setHeader>
            <toD id="_toD2"
uri="{{serviceurl}}/${exchangeProperty.resId}/movie/${exchangeProperty.id}/money/${exchangeProperty.moneyId}?authUsername={{username}}&amp;authPassword={{password}}&amp;throwExceptionOnFailure=false&amp;clientConnectionManager=#connManager"/>
            <log id="_log" message="PUT assets received response : ${body}"/>
          </split>
        </split>
      </when>
    </route>
    <onException id="_onException2">
      <exception>com.amazonaws.services.sqs.model.AmazonSQSException</exception>
      <redeliveryPolicy delayPattern="0:1000;1:2000;2:4000"
maximumRedeliveries="3"/>
      <handled>
        <constant>true</constant>
      </handled>
    </onException>
    <onException id="_onException3">
      <exception>java.net.UnknownHostException</exception>
      <redeliveryPolicy delayPattern="0:1000;1:2000;2:4000"
maximumRedeliveries="3"/>
      <handled>
        <constant>true</constant>
      </handled>
    </onException>
    <onException id="_onException4">
      <exception>org.apache.camel.http.common.HttpOperationFailedException</exception>
      <handled>
        <constant>true</constant>
      </handled>
   </onException>
    <onException id="_onException1">
      <exception>java.lang.Exception</exception>
      <handled>
        <constant>true</constant>
      </handled>
      <log id="_logExp" message="Log99 ${exception}
${exception.message} occurred while processing ${body}"/>
    </onException>
  </camelContext></blueprint>