You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by charu_khanwalkar <ch...@gmail.com> on 2016/10/26 15:19:08 UTC

Unable to stream a file from a UNIX server

Hi Team,
I am a developer ,new to Camel ,and currently working on a file monitoring
product which tracks a file moving from one component to the other. We are
supposed to stream a LOG file on a UNIX server and the product is running on
a windows servers. The way we integrate different components is by creating
routes in Apache Camel using spring XML. Please note that since the product
is s proprietary we have only limited programming capabilities available to
us  :((. below is the code I am trying to run 

def uri = "stream://file?fileName=ftp://username@server?password=(xyz)" +
request.headers["logFileName"] +
"&amp;amp;scanStream=true&amp;amp;scanStreamDelay=10000";  
                def day = request.headers["day"];
                def logFileName=request.headers["logFileName"];
                exchange.context.addRoutes(new
org.apache.camel.builder.RouteBuilder() {
                    public void configure() throws Exception {
                        from(uri).to("direct:processFile").setId(day);
                    }
                });


Here logFileName is the name of the file on the unix server I want to stream
and day is a header with the current date in yyyymmdd format
Unfortunately i am getting an error java.lang.IllegalArgumentException:
Invalid uri, valid form: 'stream:in,file,url.
Can you please suggest what is the possible mistake in this. To me it looks
like the format of the uri is not correct but i am unable to find any good
documentation on stream files in different servers.

Thank you so much for your help in advance!





--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-stream-a-file-from-a-UNIX-server-tp5789302.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Unable to stream a file from a UNIX server

Posted by charu_khanwalkar <ch...@gmail.com>.
Thank you so much for replying Quinn. I think I have moved one step ahead but
there are still issues . So i changed the code to 
 def uri =
"stream://url?url=ftp://username:password@ddeprd20/opt/ctmagent/ctm/sysout/"
+ java.net.URLDecoder.decode(request.headers["logFileName"], "US-ASCII")+
"&amp;scanStream=true&amp;scanStreamDelay=10000";
                def day = request.headers["day"];
                def logFileName=request.headers["logFileName"];
                exchange.context.addRoutes(new
org.apache.camel.builder.RouteBuilder() {
                    public void configure() throws Exception {
                        from(uri).to("direct:processFile").setId(day);
                    }
                });
The error that now I am getting is 
Exhausted after delivery attempt: 1 caught: java.io.IOException:
sun.net.ftp.FtpProtocolException: CWD opt:550 Failed to change directory.
This is an ftp error and i have access to the directory , so not sure why it
is throwing a "Failed to change directory". The 550 ftp error code is the
file is unavailable which is not true , since the file is there. Any
suggestions?

TIA




--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-stream-a-file-from-a-UNIX-server-tp5789302p5789351.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Unable to stream a file from a UNIX server

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
You’re using the stream:file endpoint with an ftp URL.  Maybe try changing "stream://file?fileName=…” to “stream://url?url=…”?


> On Oct 26, 2016, at 9:19 AM, charu_khanwalkar <ch...@gmail.com> wrote:
> 
> Hi Team,
> I am a developer ,new to Camel ,and currently working on a file monitoring
> product which tracks a file moving from one component to the other. We are
> supposed to stream a LOG file on a UNIX server and the product is running on
> a windows servers. The way we integrate different components is by creating
> routes in Apache Camel using spring XML. Please note that since the product
> is s proprietary we have only limited programming capabilities available to
> us  :((. below is the code I am trying to run 
> 
> def uri = "stream://file?fileName=ftp://username@server?password=(xyz)" +
> request.headers["logFileName"] +
> "&amp;amp;scanStream=true&amp;amp;scanStreamDelay=10000";  
>                def day = request.headers["day"];
>                def logFileName=request.headers["logFileName"];
>                exchange.context.addRoutes(new
> org.apache.camel.builder.RouteBuilder() {
>                    public void configure() throws Exception {
>                        from(uri).to("direct:processFile").setId(day);
>                    }
>                });
> 
> 
> Here logFileName is the name of the file on the unix server I want to stream
> and day is a header with the current date in yyyymmdd format
> Unfortunately i am getting an error java.lang.IllegalArgumentException:
> Invalid uri, valid form: 'stream:in,file,url.
> Can you please suggest what is the possible mistake in this. To me it looks
> like the format of the uri is not correct but i am unable to find any good
> documentation on stream files in different servers.
> 
> Thank you so much for your help in advance!
> 
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unable-to-stream-a-file-from-a-UNIX-server-tp5789302.html
> Sent from the Camel Development mailing list archive at Nabble.com.