title: camel splitter - stop looping on specific exception
body: <p>How can we stop looping on camel splitter on specific exception?
  The "stopOnException()" is stopping the looping for every exception, but instead I want to stop looping only on some specific exceptions. And if the exception is "HttpOperationFailedException", I want to stop looping based on response code.
  For example if response code is "500" stop execution and if response code is 404 continue execution.</p>
  
  <p>Is it possible?</p>
  
  <p>Original Question </p>
  
  <pre><code>from("timer:categoryRouter?delay=0")
                      .process(new Processor() {
                          @Override
                          public void process(Exchange exchange) throws Exception {
                              exchange.getIn().setBody("A,F,B,D,C");
                          }
                      })
                  // tell Splitter to use the aggregation strategy which handles and ignores exceptions
                  .split(body(), new MyIgnoreFailureAggregationStrategy())
                      .stopOnException()
                      // log each splitted message
                      .log("Split line ${body}")
                      // and have them translated into a quote
                      .bean(WordTranslateBean.class)
                      // and send it to a mock
                      .to("mock:split")
                  .end()
                  // log the outgoing aggregated message
                  .log("Aggregated ${body}")
                  // and send it to a mock as well
                  .to("mock:result");
  </code></pre>
  
  <p>Bean which throws exception:</p>
  
  <pre><code>public class WordTranslateBean {
  
  private Map&lt;String, String&gt; words = new HashMap&lt;String, String&gt;();
  
  public WordTranslateBean() {
      words.put("A", "Camel rocks");
      words.put("B", "Hi mom");
      words.put("C", "Yes it works");
  }
  
  public String translate(String key) throws HttpOperationFailedException {
      if (!words.containsKey(key)) {
          HttpOperationFailedException httpOperationFailedException = null;
          if(key.equals("F")) {
              httpOperationFailedException = new HttpOperationFailedException("uri",500,"Internal Server Error","location",null,"Key not a known word " + key);
          }
          else {
              httpOperationFailedException = new HttpOperationFailedException("uri",404,"Resource Not Found","location",null,"Operation not supported on word " + key);
          }
          throw httpOperationFailedException;
      }
      return words.get(key);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Working Solution:</p>
  
  <pre><code>from("timer:categoryRouter?delay=0")
                      .process(new Processor() {
                          @Override
                          public void process(Exchange exchange) throws Exception {
                              exchange.getIn().setBody("A,F,B,D,C");
                          }
                      })
                  // tell Splitter to use the aggregation strategy which handles and ignores exceptions
                  .split(body(), new MyIgnoreFailureAggregationStrategy())
                      .stopOnException()
                      // log each splitted message
                      .log("Split line ${body}")
                      // and have them translated into a quote
                      .doTry()
                          .bean(WordTranslateBean.class)
                          // and send it to a mock
                          .to("mock:split")
                      .doCatch(HttpOperationFailedException.class)
                          .process(new Processor() {
                              @Override
                              public void process(Exchange exchange) throws Exception {
                                  HttpOperationFailedException e = (HttpOperationFailedException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
                                  if(e.getStatusCode()!=404){
                                      throw e;
                                  }
                              }
                          })
                      .end()
                  .end()
                  // log the outgoing aggregated message
                  .log("Aggregated ${body}")
                  // and send it to a mock as well
                  .to("mock:result");
  </code></pre>