使用循环EIP解决apachecamel中的一个用例

使用循环EIP解决apachecamel中的一个用例,apache,apache-camel,Apache,Apache Camel,我有一个用例,其中我有一个路由,它以m个rest URL作为输入,然后每次点击这些URL的n次,直到响应代码为204 所以点击一个URL,直到204是响应代码,如果返回204,则转到下一个URL并应用相同的过程 我尝试使用loop EIP,但它不起作用。请建议。如果我正确理解了您的要求,类似这样的方法应该可以解决问题: <from uri="bean:cxf...." /> <setExchangePattern pattern="InOut"/> <to uri

我有一个用例,其中我有一个路由,它以m个rest URL作为输入,然后每次点击这些URL的n次,直到响应代码为204

所以点击一个URL,直到204是响应代码,如果返回204,则转到下一个URL并应用相同的过程


我尝试使用loop EIP,但它不起作用。请建议。

如果我正确理解了您的要求,类似这样的方法应该可以解决问题:

<from uri="bean:cxf...." />

<setExchangePattern pattern="InOut"/>
<to uri="jetty...." /> //hit the url

<choice>
  <when>
    <simple>CHECK_IF_HTTP_RESPONSE_CODE_HEADER_IS_204</simple>
    <to uri="mock:result" />
  </when>
  <otherwise>
    <to uri="bean:cxf...." /> //send the exchange to this very route again
  </otherwise>
</choice>

//点击网址
检查\u HTTP\u RESPONSE\u CODE\u HEADER\u是否为\u 204
//再次将交换发送到此路线

如果我正确理解了您的需求,类似这样的方法应该可以:

<from uri="bean:cxf...." />

<setExchangePattern pattern="InOut"/>
<to uri="jetty...." /> //hit the url

<choice>
  <when>
    <simple>CHECK_IF_HTTP_RESPONSE_CODE_HEADER_IS_204</simple>
    <to uri="mock:result" />
  </when>
  <otherwise>
    <to uri="bean:cxf...." /> //send the exchange to this very route again
  </otherwise>
</choice>

//点击网址
检查\u HTTP\u RESPONSE\u CODE\u HEADER\u是否为\u 204
//再次将交换发送到此路线