Attributes 属性在使用“散布聚集”后验证为空
我有一个流,可以读取文件,使用分散聚集将内容分发到2个子流,并在完成时将文件移动到Attributes 属性在使用“散布聚集”后验证为空,attributes,anypoint-studio,dataweave,mulesoft,Attributes,Anypoint Studio,Dataweave,Mulesoft,我有一个流,可以读取文件,使用分散聚集将内容分发到2个子流,并在完成时将文件移动到Output/XML或失败时移动到Failure/XML 在这两种情况下,表达式:attributes.fileName失败,因为属性为空。如何将属性设置为持久性 <flow name="validateFileContent" doc:id="58c241c9-7227-41a8-a67f-5cf4f52bb4bf" > <file:listener doc:name="Inpu
Output/XML
或失败时移动到Failure/XML
在这两种情况下,表达式:
attributes.fileName
失败,因为属性为空。如何将属性设置为持久性
<flow name="validateFileContent" doc:id="58c241c9-7227-41a8-a67f-5cf4f52bb4bf" >
<file:listener doc:name="Input changed" doc:id="2e6228a7-e153-489a-b6f6-468f67e76475" config-ref="File_Config" directory="Input/XML" watermarkMode="MODIFIED_TIMESTAMP">
<scheduling-strategy >
<fixed-frequency frequency="5" timeUnit="SECONDS" />
</scheduling-strategy>
</file:listener>
<scatter-gather doc:name="Distribute workload" doc:id="15151949-c61d-4629-9fd4-0a4e16d62eec" >
<route >
<flow-ref doc:name="CategoryToType" doc:id="e5d39afa-3b2a-45ef-81c0-afce77a76aef" name="validateCategoryToType" />
</route>
<route >
<flow-ref doc:name="CategoryToSector" doc:id="d3790ba2-b1ac-4511-b748-91adf255344a" name="validateCategoryToSector"/>
</route>
</scatter-gather>
<file:move doc:name="MoveUponSuccess" doc:id="ee659c03-7af5-4a0e-93b0-edb69aefd3ae" sourcePath='#["Input/XML/" ++ attributes.fileName]' targetPath='#["Output/XML/" ++ now() as String{format: "yyyyMMdd_HHmmss"} ++ attributes.fileName]' config-ref="File_Config"/>
<error-handler>
<on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" doc:id="16001c58-7609-42a6-9bfa-1cd756998f27" >
<logger level="INFO" doc:name="Logger" doc:id="8ec2af18-3e45-4d15-a373-5e9af74723d7" message="#[error]"/>
<file:move doc:name="MoveUponFailure" doc:id="53653598-1d44-4d9a-903c-e82fa61be842" config-ref="File_Config" sourcePath='#["Input/XML/" ++ attributes.fileName]' targetPath='#["Failure/XML/" ++ now() as String{format: "yyyyMMdd_HHmmss"} ++ attributes.fileName]' />
</on-error-propagate>
</error-handler>
</flow>
我尝试为输入/输出属性设置元数据
,但失败了。我可以想象将其放入var,但我认为必须有更好的解决方案。堆栈跟踪: 消息:“您使用这些函数调用了函数'++' 参数:1:String(“Input/XML/”)2:Null(Null) 但它期望这些组合中的一个:(数组,数组)(日期, 时间)(日期,本地时间)(日期,时区)(本地日期时间, 时区)(本地时间,日期)(本地时间,时区)(对象, 对象)(字符串,字符串)(时间,日期)(时区,LocalDateTime) (时区,日期)(时区,本地时间) 1 |“Input/XML/”++attributes.fileName
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^跟踪:at++(行:1,列: 1) 在main(第1行,第14列)处,“求值表达式: “”输入/XML/“++attributes.fileName”。错误类型: 骡子:表情
否,如果要保留该属性,则必须将其保存到变量。无法保证流中的其他内容不会覆盖它。例如,使用任何连接器。 此外,元数据用于设计时,而不是执行时