简体   繁体   English

MULE ESB将查询结果导出到CSV

[英]MULE ESB Export Query Result to CSV

I've builded a simple REST API with two resources. 我用两个资源构建了一个简单的REST API。 One to recover a collection of Trips (GET /trips) and another to recover trips to a certain place (GET /trips/{place}. Both recover data from a MySql database. The API is working y can execute both queries and return the results but I'd like to export DATA to a CSV file. 一个用于恢复Trips的集合(GET / trips),另一个用于恢复到特定位置的Trips(GET / trips / {place}。两者均从MySql数据库中恢复数据。该API可以执行两个查询并返回结果,但我想将数据导出到CSV文件。

I need a HINT about how to export the resultset to a CSV file. 我需要有关如何将结果集导出到CSV文件的提示。 Should I need a transformer or an object to string component? 我是否需要一个转换器或一个对象来串接组件?

You can use Dataweave (Transform Message) to reach it. 您可以使用Dataweave(转换消息)来访问它。 See some examples here: https://estebanwasinger.wordpress.com/2015/12/31/dataweave-examples-transform-json-and-xml-list-to-csv/ 在此处查看一些示例: https : //estebanwasinger.wordpress.com/2015/12/31/dataweave-examples-transform-json-and-xml-list-to-csv/

Try it and we will help you if you get stuck. 尝试一下,如果您遇到困难,我们将为您提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM