You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by buyleg <gb...@gmail.com> on 2017/01/24 15:39:41 UTC
manage headers
Is it possible to manage the header with a bean instead of setHeader for each
value?
What I mean: Could you use replace the following:
from("file://{{main.dir}}/1_CHECK_MD5/?include=.*voucher.xml&move=DONE&moveFailed=ERRORS/${file:name.noext}
${header.ErrorInFileName}.${file:ext}&sortBy=file:name")
.routeId("2_READ_VOUCHER_COPY_ZIP_ROUTE")
*.setHeader("Voucher", simple("${body}")) //Save Voucher
// Create business log
.setHeader("TransactionId",
simple(UUID.randomUUID().toString()))
.setHeader("VoucherName", xpath("//metaData/voucherName/text()",
String.class))
.setHeader("VoucherTimestamp",
xpath("//metaData/timestamp/text()", String.class))
.setHeader("CbssBatchId",
xpath("//metaData/uniqueIdentifier/text()", String.class))
.setHeader("FilenameNodeList",
xpath("//packagedLotFiles/packagedLotFile/lotFileName/text()",
NodeList.class))
.setHeader("FilenameList",
method(XmlUtils.class,"nodeListToCSVString(${header.FilenameNodeList})"))*
.bean(BatchLog.class, "createBatchIn(${header.TransactionId},
CBSS_FTP:{{sftpCbss.ip}}, ${header.VoucherName}, ${header.FilenameList}, 0,
${header.CbssBatchId}, "
+"${header.VoucherTimestamp}, PROVICBSS,
UPDATE_PERSON_DATA, {{main.applicationid}})")
.setHeader(....) => in a custom bean
--
View this message in context: http://camel.465427.n5.nabble.com/manage-headers-tp5793035.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: manage headers
Posted by Zoran Regvart <zo...@regvart.com>.
Hi,
one option would be to implement a custom processor[1]
zoran
[1] http://camel.apache.org/processor.html
On Tue, Jan 24, 2017 at 4:39 PM, buyleg <gb...@gmail.com> wrote:
> Is it possible to manage the header with a bean instead of setHeader for each
> value?
> What I mean: Could you use replace the following:
> from("file://{{main.dir}}/1_CHECK_MD5/?include=.*voucher.xml&move=DONE&moveFailed=ERRORS/${file:name.noext}
> ${header.ErrorInFileName}.${file:ext}&sortBy=file:name")
> .routeId("2_READ_VOUCHER_COPY_ZIP_ROUTE")
> *.setHeader("Voucher", simple("${body}")) //Save Voucher
> // Create business log
> .setHeader("TransactionId",
> simple(UUID.randomUUID().toString()))
> .setHeader("VoucherName", xpath("//metaData/voucherName/text()",
> String.class))
> .setHeader("VoucherTimestamp",
> xpath("//metaData/timestamp/text()", String.class))
> .setHeader("CbssBatchId",
> xpath("//metaData/uniqueIdentifier/text()", String.class))
> .setHeader("FilenameNodeList",
> xpath("//packagedLotFiles/packagedLotFile/lotFileName/text()",
> NodeList.class))
> .setHeader("FilenameList",
> method(XmlUtils.class,"nodeListToCSVString(${header.FilenameNodeList})"))*
> .bean(BatchLog.class, "createBatchIn(${header.TransactionId},
> CBSS_FTP:{{sftpCbss.ip}}, ${header.VoucherName}, ${header.FilenameList}, 0,
> ${header.CbssBatchId}, "
> +"${header.VoucherTimestamp}, PROVICBSS,
> UPDATE_PERSON_DATA, {{main.applicationid}})")
>
> .setHeader(....) => in a custom bean
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/manage-headers-tp5793035.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Zoran Regvart
Re: manage headers
Posted by Claus Ibsen <cl...@gmail.com>.
The Camel books such as Camel in Action or Camel Cookbook covers all
of that and much more.
You can also browse the online web pages and find some information /
snippets how to do that. But buying one of the books really help you /
your company.
On Fri, Jan 27, 2017 at 10:58 AM, buyleg <gb...@gmail.com> wrote:
> Thanks for your replies.
> I am a newbie to learn Camel.
> I would like if it is possible to get an example how to create the custom
> processor bean and certainly how to get the xml data into the headers via a
> custom bean.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/manage-headers-tp5793035p5793100.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: manage headers
Posted by buyleg <gb...@gmail.com>.
Thanks for your replies.
I am a newbie to learn Camel.
I would like if it is possible to get an example how to create the custom
processor bean and certainly how to get the xml data into the headers via a
custom bean.
--
View this message in context: http://camel.465427.n5.nabble.com/manage-headers-tp5793035p5793100.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: manage headers
Posted by Claus Ibsen <cl...@gmail.com>.
Yes there is the method call
setHeader "foo" method(MyBean.class, "doSomething")
On Tue, Jan 24, 2017 at 4:39 PM, buyleg <gb...@gmail.com> wrote:
> Is it possible to manage the header with a bean instead of setHeader for each
> value?
> What I mean: Could you use replace the following:
> from("file://{{main.dir}}/1_CHECK_MD5/?include=.*voucher.xml&move=DONE&moveFailed=ERRORS/${file:name.noext}
> ${header.ErrorInFileName}.${file:ext}&sortBy=file:name")
> .routeId("2_READ_VOUCHER_COPY_ZIP_ROUTE")
> *.setHeader("Voucher", simple("${body}")) //Save Voucher
> // Create business log
> .setHeader("TransactionId",
> simple(UUID.randomUUID().toString()))
> .setHeader("VoucherName", xpath("//metaData/voucherName/text()",
> String.class))
> .setHeader("VoucherTimestamp",
> xpath("//metaData/timestamp/text()", String.class))
> .setHeader("CbssBatchId",
> xpath("//metaData/uniqueIdentifier/text()", String.class))
> .setHeader("FilenameNodeList",
> xpath("//packagedLotFiles/packagedLotFile/lotFileName/text()",
> NodeList.class))
> .setHeader("FilenameList",
> method(XmlUtils.class,"nodeListToCSVString(${header.FilenameNodeList})"))*
> .bean(BatchLog.class, "createBatchIn(${header.TransactionId},
> CBSS_FTP:{{sftpCbss.ip}}, ${header.VoucherName}, ${header.FilenameList}, 0,
> ${header.CbssBatchId}, "
> +"${header.VoucherTimestamp}, PROVICBSS,
> UPDATE_PERSON_DATA, {{main.applicationid}})")
>
> .setHeader(....) => in a custom bean
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/manage-headers-tp5793035.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2