需要通过MULE ESB从S3存储桶中检索对象列表。但是当获取payload.getkey()时,它会抛出错误:无法解析方法:org.mule.module.s3.model.ObjectListing.getKey()[arglength = 0]]
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9090" doc:name="HTTP Listener Configuration"/>
<s3:config name="Amazon_S3__Configuration" accessKey="XXXXXXX" secretKey="XXXXXXXX" doc:name="Amazon S3: Configuration"/>
<flow name="s3bucket-downloadfilesFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/getfiles" doc:name="HTTP"/>
<s3:list-objects config-ref="Amazon_S3__Configuration" bucketName="ge-datastaging-dev" prefix="Mule/inbound/" maxKeys="5" doc:name="Amazon S3"/>
<logger level="INFO" doc:name="Logger"/>
<foreach collection="#[payload]" doc:name="For Each">
<logger level="INFO" doc:name="Logger" message=" inside foreach...... #[payload.getCommonPrefixes()] ...."/>
<logger level="INFO" doc:name="Logger" message=" ################...... #[payload.getNextMarker()] ...."/>
<logger level="INFO" doc:name="Logger" message=" ################...... #[payload.getKey()] ...."/>
</foreach>
</flow>
答案 0 :(得分:0)
不要在payload
上循环,而是<foreach>
ObjectSummaries
对象ObjectListing
上的<s3:list-objects config-ref="Amazon_S3__Configuration" bucketName="ge-datastaging-dev" prefix="Mule/inbound/" maxKeys="5" doc:name="Amazon S3"/>
<foreach doc:name="For Each" collection="#[payload.objectSummaries]">
<s3:get-object-content config-ref="Amazon_S3__Configuration" bucketName="#[payload.getBucketName()]" key="#[payload.getKey()]" doc:name="Amazon S3"/>
</foreach>
:
$.get(/some/path/here, {id: projectId, next: 4}).done(function(response)