camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pholder <philipp.hol...@cit.de>
Subject redeliveryPolicy onException based on HTTP statusCode
Date Fri, 11 Sep 2015 14:45:49 GMT
Hello all,

I am looking for a way to have a different redeliveryPolicy in Case the HTTP
statusCode is '503'.
I guess, I could do a try/catch finally every time I make a HTTP-Request. My
hope was to make that switch at one position, for all routes.

Does anyone have a thought on this problem.

This is what I have tried:


<onException>
     
<exception>org.apache.camel.component.http.HttpOperationFailedException</exception>

      
<process ref="getHttpStatus"/>

      <choice>
        <when>
          <simple>${exchangeProperty[errorStatusCode]} == '503'</simple>
          <throwException ref="ServiceNotAvailableException"/>
        </when>
        <otherwise>
          <throwException ref="HttpErrorException"/>
        </otherwise>
      </choice>
    </onException>


    <onException>
     
<exception>de.cit.eg.transfer.exception.ServiceTemporarilyNotAvailableException</exception>
      <redeliveryPolicy asyncDelayedRedelivery="true"
redeliveryDelay="3600000" maximumRedeliveries="3" logRetryAttempted="true"
logNewException="false" retryAttemptedLogLevel="WARN"
backOffMultiplier="4"/>

      <to
uri="log:configLogger?level=ERROR&amp;showProperties=true&amp;showException=true&amp;showCaughtException=true&amp;showStackTrace=true&amp;multiline=true"/>
    </onException>


<onException>
     
<exception>de.cit.eg.transfer.exception.DefaultHttpException</exception>

      <to
uri="log:configLogger?level=ERROR&amp;showProperties=true&amp;showException=true&amp;showCaughtException=true&amp;showStackTrace=true&amp;multiline=true"/>

    </onException>

With regards



--
View this message in context: http://camel.465427.n5.nabble.com/redeliveryPolicy-onException-based-on-HTTP-statusCode-tp5771448.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message