簡體   English   中英

Apache 駱駝多端點

[英]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&amp;charset=utf-8" />
            <to uri="file:{{export.select_2.dir}}?fileName=exportSelect_${property.exportSelectFileName}.csv&amp;charset=utf-8&amp;fileExist=Append" />
        
    </multicast>

你有其他建議嗎? 否則有沒有可能用 groovy 來做?

您可以使用竊聽來復制消息並將其發送到第一個端點。 或者將正文放在屬性中並在第一個端點調用后獲取它。 不同之處在於您的錯誤處理策略。

我在下面找到了這個,對我來說很好用

<recipientList>
     <constant>file:{{export.select.dir}}?fileName=${property.exportSelectFileName}_exportSelect.csv&amp;charset=utf-8,file:{{export.select_2.dir}}?fileName=exportSelect_${property.exportSelectFileName}.csv&amp;charset=utf-8&amp;fileExist=Append </constant>
</recipientList>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM