【问题标题】:How to make a call to multiple rest service in mulesoft如何在 mulesoft 中调用多个休息服务
【发布时间】:2018-09-06 16:24:48
【问题描述】:

我有一个需求,我需要调用多个休息服务。

目前我只调用一项休息服务,因为文件很大,我们已经分成几部分(如 1 到 10k、10k 到 20k、20k 到 30k...等等)

该流程旨在读取完整的文件,现在它已被拆分。

流程是这样的:

HTTP请求者(WS调用)----业务逻辑。

我想调用多个服务(1 到 10k,10k 到 20k,20k 到 30k...等等)并使用相同的通用业务逻辑流程。

如何配置?

【问题讨论】:

    标签: mule esb mule-studio mule-component


    【解决方案1】:

    如果您需要为每条记录按顺序调用 rest api,您可以在批处理步骤中执行此操作。

    如果您需要在没有任何序列的情况下进行 rest api 调用,那么您可以在批处理中使用 scatter gather。

    可以通过配置batch size来设置并行处理的记录数。

    参考:https://docs.mulesoft.com/mule-user-guide/v/3.6/scatter-gather https://dzone.com/articles/part-1-mule-batch-processing-introduction

    【讨论】:

    • 感谢您的帮助
    • thanx 的帮助............下面的URL需要一个接一个的调用,如何在Mule中配置?目前我正在使用 HTTP 请求器,我可以通过传递 URI 和查询参数来调用第一个 URL。我的问题是如何依次调用另一个 2 URL?我在属性文件中定义为:workday.contextpath.getURL1 = Z+-+ISU/Z_-All_Domains-All_Domains workday.contextpath.getURL2 = Z+-+ISU/Z -INT93-_All_Domains workday.contextpath.getURL3 = Z+-+ISU/Z-RPT_D
    • 你可以分批做
    【解决方案2】:

    Mule 通过使用scatter-gather 组件来实现这一点。请注意此用例中的异常处理。如果一条或多条路由失败,您需要对此进行控制。

    <scatter-gather timeout="6000">
        <!-- custom-aggregation-strategy class="implement and place your class here if you need a custom strategy"/-->    
        <http:request config-ref="requestConfig1" path="/path1" method="POST" doc:name="HTTP"/>
        <http:request config-ref="requestConfig2" path="/path2" method="POST" doc:name="HTTP"/>
        <http:request config-ref="requestConfig3" path="/path3" method="POST" doc:name="HTTP"/>
    </scatter-gather>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-02
      • 2011-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-31
      • 2019-02-13
      • 1970-01-01
      相关资源
      最近更新 更多