Read contents of a file containing key value pairs without normal parsing(读取包含键值对的文件的内容,无需正常解析)
问题描述
我的方案是从文件端点读取文件,该文件仅包含键值 paris,如属性文件,并根据键从中获取一些数据.
My scenario is to read a file from a file endpoint which contains only key value paris like a property file and take a few data from it based on the key .
知道如何使用自定义 bean 或 java 组件来完成它们.
Any idea how to do them other that using a custom bean or java component.
我想知道这在 Mule 或 Camel 中是否可行.
I would like to know if this is possible any way in Mule or Camel.
提前致谢.
推荐答案
如果你想使用 Camel 路由来获取文件,那么像这样
If you want to use a Camel route, to pickup files, then something like this
from("file:inbox")
.convertBodyTo(Properties.class)
.log("The foo value is {${body[foo]}")
.log("The bar value is {${body[bar]}")
然后我们需要一个来自 java.io.File -> java.util.Properties 的类型转换器.我们可以直接将其添加到 camel-core 中.
What we then need is a type converter from java.io.File -> java.util.Properties. Which we could add to camel-core out of the box.
我记录了一张在 Camel 中添加该类型转换器的票:https://issues.apache.org/jira/browse/CAMEL-7312
I logged a ticket to add that type converter out of the box in Camel: https://issues.apache.org/jira/browse/CAMEL-7312
这篇关于读取包含键值对的文件的内容,无需正常解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:读取包含键值对的文件的内容,无需正常解析


- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01