如何在m子流中循环遍历对象库的键/值 [英] How to loop over the keys/values of a objectstore in mule flow

查看:74
本文介绍了如何在m子流中循环遍历对象库的键/值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想遍历对象存储条目的所有值,并将它们记录在a流中.我正在尝试做这样的事情-是正确的还是有更好的东西.我不想使用Java.

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>

推荐答案

我会争辩说,您正在尝试将基本的过程代码插入到管道和过滤器模式将流处理器用于用例,这些用例自然会调用管道和过滤器,并将过程逻辑封装在组件内,然后将组件包括在流中.避免使用Mule构造编写过程逻辑.我知道像大多数设计问题一样,都有一些灰色区域,但是在大多数情况下,可以达成最佳实践.

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.

这篇关于如何在m子流中循环遍历对象库的键/值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆