You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Jan Bares, WOOD & Co." <ja...@wood.cz> on 2024/01/12 12:27:38 UTC
Seeking documentation how to write consumer endpoint
Hi,
I search for any documentation / resources / samples on how to write consumer endpoint. So far I have found naive or buggy samples in:
Camel in Action 2nd Edition
https://self-learning-java-tutorial.blogspot.com/2019/01/camel-implement-custom-protocol.html
I need to read a XML file with list of tags (or just chunks of text delimited by some string) given the following constraints
* new chunks are added at the end, each new chunk should create new Exchange
* the file can be truncated to zero length and started over at any time, special Exchange must be created
* the header of the file contains "creation timestamp" that is used to detect the file truncation
(please do not suggest me to change the way the file data are produced)
I don't think that I can use the *file* component to achieve this.
Thank you for any pointers, Jan
Jan Bares
Head of Calypso development | IT Development
Phone: +420 222 096 457
Mobile: +420 776 333 676
Email: jan.bares@wood.cz
WOOD & Company
Palladium, n?m. Republiky 1079/1a, 110 00 Prague 1, Czech Republic | wood.cz
________________________________
DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Slovakia by the NBS, in Italy by the CONSOB and in the UK by the FCA as Host State regulators. For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.com<http://www.wood.com/> under section Corporate Governance. Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment research opinions. This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).
Re: Seeking documentation how to write consumer endpoint
Posted by Claudio Miranda <cl...@claudius.com.br>.
Em sex., 12 de jan. de 2024 às 13:42, Jan Bares, WOOD & Co.
<ja...@wood.cz> escreveu:
>
> we already use everything you mension bellow on files that *do not change*. My current requirement is to read file that *changes* over the time, I can imagine that we can handle appends with Camel but we need also to handle and *detect* (e.g. set special header) , when the file is *truncated*.
There is a component to watch file changes.
https://camel.apache.org/components/4.0.x/file-watch-component.html
If you want to optimize the read operation to read specific file
content, you have to look at ways to control content read for special
marks and content.
camel-file component has some configuration to allow you to plug your
implementation, look for processStrategy,
https://camel.apache.org/components/4.0.x/file-component.html
--
Claudio Miranda
claudio@claudius.com.br
http://www.claudius.com.br
RE: Seeking documentation how to write consumer endpoint
Posted by "Jan Bares, WOOD & Co." <ja...@wood.cz>.
Thanks Claudio
we already use everything you mension bellow on files that *do not change*. My current requirement is to read file that *changes* over the time, I can imagine that we can handle appends with Camel but we need also to handle and *detect* (e.g. set special header) , when the file is *truncated*.
Kind regards, Jan
> -----Original Message-----
> From: Claudio Miranda <cl...@claudius.com.br>
> Sent: Friday, January 12, 2024 1:59 PM
> To: users@camel.apache.org
> Subject: Re: Seeking documentation how to write consumer endpoint
>
> Em sex., 12 de jan. de 2024 às 12:28, Jan Bares, WOOD & Co.
> <ja...@wood.cz> escreveu:
> >
> > I need to read a XML file with list of tags (or just chunks of text delimited by
> some string) given the following constraints
> > * new chunks are added at the end, each new chunk should create new Exchange
> > * the file can be truncated to zero length and started over at any time, special
> Exchange must be created
> > * the header of the file contains "creation timestamp" that is used to detect the
> file truncation
>
> From what you described you don't have to create a new component, but
> to create a route that uses a consumer to receive the xml payload and
> then process it.
> The consumer can be a file, ftp, queue, etc.
> The processor will read the xml payload and process it.
> Then the resulting work may be sent for post processing purposes to
> other system.
>
> I suggest you read about camel EIPs, there are several ways to process
> the xml payload. Look for streaming, split, tokenizer, filter.
>
> https://camel.apache.org/components/4.0.x/eips/enterprise-integration-
> patterns.html
> https://github.com/apache/camel-examples/tree/main
>
> --
> Claudio Miranda
>
> claudio@claudius.com.br
> http://www.claudius.com.br
Jan Bares
Head of Calypso development | IT Development
Phone: +420 222 096 457
Mobile: +420 776 333 676
Email: jan.bares@wood.cz
WOOD & Company
Palladium, nám. Republiky 1079/1a, 110 00 Prague 1, Czech Republic | wood.cz
________________________________
DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Slovakia by the NBS, in Italy by the CONSOB and in the UK by the FCA as Host State regulators. For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.com<http://www.wood.com/> under section Corporate Governance. Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment research opinions. This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).
Re: Seeking documentation how to write consumer endpoint
Posted by Claudio Miranda <cl...@claudius.com.br>.
Em sex., 12 de jan. de 2024 às 12:28, Jan Bares, WOOD & Co.
<ja...@wood.cz> escreveu:
>
> I need to read a XML file with list of tags (or just chunks of text delimited by some string) given the following constraints
> * new chunks are added at the end, each new chunk should create new Exchange
> * the file can be truncated to zero length and started over at any time, special Exchange must be created
> * the header of the file contains "creation timestamp" that is used to detect the file truncation
From what you described you don't have to create a new component, but
to create a route that uses a consumer to receive the xml payload and
then process it.
The consumer can be a file, ftp, queue, etc.
The processor will read the xml payload and process it.
Then the resulting work may be sent for post processing purposes to
other system.
I suggest you read about camel EIPs, there are several ways to process
the xml payload. Look for streaming, split, tokenizer, filter.
https://camel.apache.org/components/4.0.x/eips/enterprise-integration-patterns.html
https://github.com/apache/camel-examples/tree/main
--
Claudio Miranda
claudio@claudius.com.br
http://www.claudius.com.br