使用网站上的mule read txt文件

时间:2014-04-29 12:14:38

标签: mule

我对骡子很新。我正在尝试读取一个输出txt文件的http链接。 我想在mule中调用此链接,读取文本并将数据插入数据库。

当文件来自http时,任何人都可以建议我如何在mule中读取txt文件。 提前致谢。

2 个答案:

答案 0 :(得分:1)

让我们考虑一下HTTP网址localhost:8081/service,它会在调用时提供文本输出 因此,要从Mule流程调用它,您需要配置用于调用外部URL的HTTP出站或HTTP请求组件。
因此,您需要按以下方式配置它: -
如果您使用 Mule 3.5 或更早版本,则需要出站端点: -

<http:outbound-endpoint exchange-pattern="request-response" address="localhost:8081/service" method="GET" doc:name="HTTP"/>           

如果您使用的是 Mule 3.6 或更高版本,则需要Http请求组件: -

<http:request-config name="HTTP_Request_Configuration" host="localhost" port="8081"  doc:name="HTTP Request Configuration"/>

骡子 流程: -

<http:request config-ref="HTTP_Request_Configuration" path="/service" method="GET" doc:name="Call external service" />

参考: - https://developer.mulesoft.com/docs/display/current/HTTP+Request+Connector

从Mule流程调用外部URL后,您将获得文本作为有效负载,您可以使用SQL查询将其插入数据库

答案 1 :(得分:0)

相关问题