我正在使用 Mule 4 和 Anypoint Studio 7,我只想从 AWS 中的 S3 存储桶中获取 Excel 文件。我正在寻找一种方法来过滤 *.xlsx 之类的 Excel 文件类型,但不确定我可以在连接器中的何处执行此操作。
我的代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:s3="http://www.mulesoft.org/schema/mule/s3"
xmlns:sftp="http://www.mulesoft.org/schema/mule/sftp"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/sftp http://www.mulesoft.org/schema/mule/sftp/current/mule-sftp.xsd
http://www.mulesoft.org/schema/mule/s3 http://www.mulesoft.org/schema/mule/s3/current/mule-s3.xsd">
<flow name="getExcelFiles" doc:id="21bd363a-166e-4fc2-9246-dd6f48763db7" >
<flow-ref doc:name="logStartFlow" doc:id="b2504769-bd82-44a2-aab3-d6427c04bbde" name="logStartFlow"/>
<s3:list-objects doc:name="List objects" doc:id="640ed7a3-2e0f-4c5d-99a1-fd503d02f055" config-ref="Amazon_S3_Configuration" bucketName="myBucket"/>
<foreach doc:name="For Each" doc:id="f0989986-2d2e-4cc9-b51e-d61cf9d01210" >
<s3:get-object doc:name="Get File from AWS S3" doc:id="568ed3c4-d7f8-4657-a515-835e5671b72c" config-ref="Amazon_S3_Configuration" bucketName="#[payload.bucketName]" key="#[payload.key]"/>
</foreach>
<flow-ref doc:name="logCompletedFlow" doc:id="e4df0b09-4e4b-4016-bacd-2b34062356a2" name="logCompletedFlow"/>
</flow>
</mule>
谢谢