Quantcast

Camel-Stream URI error

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Camel-Stream URI error

Gnanaguru S

Hi,

I created a route using camel stream. It worked fine. When I added the option ' scanStream ' . I was caught up witht this error.

[ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:2.9.2:run (default-cli) on project camel-ex
ample-osgi: null: MojoExecutionException: InvocationTargetException: Line 28 in XML document from file [D:\Cam
el\apache-camel-2.9.2\examples\camel-example-osgi\target\classes\META-INF\spring\camelContext.xml] is invalid;
 nested exception is org.xml.sax.SAXParseException: The reference to entity "scanStream" must end with the ';'
 delimiter. -> [Help 1]

This is my route: Please help.

<route>
      <from uri="stream:in:file?fileName=/input/test.txt&scanStream=true&scanStreamDelay=1000"/>
      <to uri="file://output"/>
    </route>

Regards
Guru
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[SOLVED]Re: Camel-Stream URI error

Gnanaguru S

Hi,

I replaced & with ?. Working between different dsl's of camel. Got into confusion.

This is the modified working code.

<from uri="stream:in:file?fileName=/input/test.txt?scanStream=true?scanStreamDelay=1000"/>

Regards
Guru
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [SOLVED]Re: Camel-Stream URI error

Claus Ibsen-2
Hi

In XML you cannot use & in the attributes, you must use an XML escaped
value as &amp;
So it should be

<from uri="stream:in:file?fileName=/input/test.txt&amp;scanStream=true&amp;scanStreamDelay=1000"/>



On Tue, Apr 24, 2012 at 11:36 AM, Gnanaguru S
<[hidden email]> wrote:

>
> Hi,
>
> I replaced & with ?. Working between different dsl's of camel. Got into
> confusion.
>
> This is the modified working code.
>
> <from
> uri="stream:in:file?fileName=/input/test.txt?scanStream=true?scanStreamDelay=1000"/>
>
> Regards
> Guru
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Stream-URI-error-tp5661443p5661468.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [SOLVED]Re: Camel-Stream URI error

Gnanaguru S
Thanks Claus,

Its working perfect. Got your point.


Regards
Guru
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [SOLVED]Re: Camel-Stream URI error

Gnanaguru S

Hi Claus,

I am getting empty files when routing from stream endpoint.

I want to read each new line and update to other file.

My route:

Please share your view.

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
      <from uri="stream:in:file?fileName=//input//test.txt&amp;scanStream=true&amp;scanStreamDelay=1000"/> 
      <to uri="file://output"/>
<to uri="log:SUCCESS"/>
    </route>
  </camelContext>

Regards
Guru
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [SOLVED]Re: Camel-Stream URI error

Claus Ibsen-2
On Tue, Apr 24, 2012 at 1:05 PM, Gnanaguru S
<[hidden email]> wrote:
>
> Hi Claus,
>
> I am getting empty files when routing from stream endpoint.
>

What do you mean by empty files? Do you get an empty message?


> I want to read each new line and update to other file.
>
> My route:
>
> Please share your view.
>
> <camelContext xmlns="http://camel.apache.org/schema/spring">
>    <route>
>      <from
> uri="stream:in:file?fileName=//input//test.txt&amp;scanStream=true&amp;scanStreamDelay=1000"/>
>      <to uri="file://output"/>
> <to uri="log:SUCCESS"/>
>    </route>
>  </camelContext>
>
> Regards
> Guru
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Stream-URI-error-tp5661443p5661666.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [SOLVED]Re: Camel-Stream URI error

Gnanaguru S

Yes. Claus.I am getting empty message.

This is my scenario.

1. I have a log file( Txt file) it is getting updated from one system. I want to read every new line updated and write to a database.

2. Every time I should not read a file from first line, Hope you can understand.

3. Instead of a database, First am trying to write with a file.

Please help me how I can do this using Camel. I read file concepts in camel in action, But I was not able to get any idea for my use case.

Regards
Guru
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [SOLVED]Re: Camel-Stream URI error

Claus Ibsen-2
Hi

I am not sure why you get empty lines. The components is using the API
from the JDK to read a line by line with code
   line = br.readLine();

If you can reproduce the issue, then I suggest to use a debugger in
the readFromStream method in the StreamConsumer, and see what is going
on.

Also it could be the fact that the other party is writing an empty
line to the file etc.
Also consider upgrade to a newer version of Camel and try out, to see
if that helps.


On Wed, Apr 25, 2012 at 12:22 PM, Gnanaguru S
<[hidden email]> wrote:

>
> Yes. Claus.I am getting empty message.
>
> This is my scenario.
>
> 1. I have a log file( Txt file) it is getting updated from one system. I
> want to read every new line updated and write to a database.
>
> 2. Every time I should not read a file from first line, Hope you can
> understand.
>
> 3. Instead of a database, First am trying to write with a file.
>
> Please help me how I can do this using Camel. I read file concepts in camel
> in action, But I was not able to get any idea for my use case.
>
> Regards
> Guru
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Stream-URI-error-tp5661443p5664420.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Loading...