How to loop over the keys/values of a objectstore in mule flow

£可爱£侵袭症+ 提交于 2019-12-24 17:25:37

问题


I want to iterate over all the values of the objectstore entries and log them in a mule flow. I am trying to do something like this -- is this correct or there is something better. I don't want to use java.

<objectstore:allkeys config-ref="ObjectStore" targetProperty="PropertyKey" targetScope="SESSION"/> 
 <foreach collection="#[PropertyKey]" doc:name="Splitting Locations_XML into chunks">
  <logger message="Key--#[payload]" level="INFO" doc:name="Logger"/>
  <objectstore:retrieve key="#[payload]" config-ref="ObjectStore" targetProperty="PropertyValue" targetScope="SESSION"/>
  <logger message="Value--#[payload]" level="INFO" doc:name="Logger"/>
</foreach>

回答1:


I would argue that you are trying to shoe horn essentially procedural code into a pipes and filters pattern use flow processors for use cases which naturally call out for pipes and filters and encapsulate procedural logic within components and then include the component within the flow. Avoid writing procedural logic using Mule constructs. I know like most design issues there is some grey area but in most cases a best practice can be agreed upon.

From a purely implementation view point this does look valid.



来源:https://stackoverflow.com/questions/31752528/how-to-loop-over-the-keys-values-of-a-objectstore-in-mule-flow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!