[英]Apache camel multiple endpoints
我做了一个 sql select 并将数据保存在 CSV 中。这里我想做的是将 sql 结果发送到两个端点。
我正在使用骆驼版本 2.12.3
我尝试使用多播,但它不适用于第二个端点。 我只有第一个文件有 sql 结果,第二个文件没有
<to uri="sql:{{export.select.query}}?dataSource=selectDataSource" />
<marshal>
<csv autogenColumns="true" delimiter="|" />
</marshal>
<multicast stopOnException="true">
<to uri="file:{{export.select.dir}}?fileName=${property.exportSelectFileName}_exportSelect.csv&charset=utf-8" />
<to uri="file:{{export.select_2.dir}}?fileName=exportSelect_${property.exportSelectFileName}.csv&charset=utf-8&fileExist=Append" />
</multicast>
你有其他建议吗? 否则有没有可能用 groovy 来做?
您可以使用窃听来复制消息并将其发送到第一个端点。 或者将正文放在属性中并在第一个端点调用后获取它。 不同之处在于您的错误处理策略。
我在下面找到了这个,对我来说很好用
<recipientList>
<constant>file:{{export.select.dir}}?fileName=${property.exportSelectFileName}_exportSelect.csv&charset=utf-8,file:{{export.select_2.dir}}?fileName=exportSelect_${property.exportSelectFileName}.csv&charset=utf-8&fileExist=Append </constant>
</recipientList>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.