gpt4 book ai didi

apache-camel - apache Camel 轮询休息端点

转载 作者:行者123 更新时间:2023-12-01 09:17:23 25 4
gpt4 key购买 nike

我有一个休息端点 sample.org,它返回表单的 json 响应

{
"response" : "pending"
}

我的路线是这样的
from("http://sample.org")
.marshal(xmlFormatConverterUtil.getxmlJsonDataFormat()) //To convert into json as I receive data in xml format which needs to be converted to json

我读过 polling consumer但找不到有关如何继续轮询端点的示例,直到它返回响应为“成功”。

是否应该使用轮询消费者?如果是这样,可以举例说明与我的情况相关的示例。轮询其余端点的任何其他资源都将非常有用。

最佳答案

您需要从计时器开始,然后调用其余端点。然后你可以检查结果,如果它然后使用控制总线停止路线。过滤器可用于检查其是否挂起,然后停止继续路由,然后下一个计时器将重试。

沿着这条伪路线

from timer
to http
marshal
filter (if pending)
stop
end
to something with positive response
to controlbus stop route

您可以在以下位置找到更多详细信息
  • http://camel.apache.org/timer
  • http://camel.apache.org/controlbus
  • http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
  • http://camel.apache.org/message-filter.html
  • 关于apache-camel - apache Camel 轮询休息端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40760962/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com