I do a sql select and save the data in CSV. Here i would like to do is sending the sql result to two endpoints.
I am using camel version 2.12.3
I tried with multicast but it doesn't work for the seconde endpoint. I have the sql result only in first file but not the seconde
<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>
Do you have other suggestion? Otherwise is there any possiblity to do it with groovy?
You could use a wiretap to duplicate the message and send it to the first endpoint. Or put the body in a property and get it after the first endpoint call. The différence is on your error handling strategy.
I found this below and it works fine for me
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.