You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kalber <Ka...@swslt.com> on 2013/08/14 09:57:23 UTC

ftp component, no download

Hi,

i'm using the ftp server example with my server, user.. and it works. Below
the output :

[INFO] --- exec-maven-plugin:1.1.1:java (default-cli) @ camel-example-ftp
---
2013-08-14 08:30:36,422 [tpServer.main()] INFO  MainSupport                   
- Apache Camel 2.11.1 starting
*********************************************************************************
Camel will route files from the FTP server:
ftp://xx.xx.com:21/?username=xxx&password=xxxx&delay=5s to the
target/download directory.
You can configure the location of the ftp server in the
src/main/resources/ftp.properties file.
Use ctrl + c to stop this application.
*********************************************************************************
2013-08-14 08:30:36,604 [tpServer.main()] INFO  DefaultCamelContext           
- Apache Camel 2.11.1 (CamelContext: camel-1) is starting
2013-08-14 08:30:36,657 [tpServer.main()] INFO  ManagementStrategyFactory     
- JMX enabled.
2013-08-14 08:30:36,736 [tpServer.main()] INFO  DefaultTypeConverter          
- Loaded 172 type converters
2013-08-14 08:30:36,896 [tpServer.main()] INFO  DefaultCamelContext           
- Route: route1 started and consuming from:
Endpoint[ftp://service.sad.it:21/?delay=5s&password=******&username=xxxx]
2013-08-14 08:30:36,896 [tpServer.main()] INFO 
ultManagementLifecycleStrategy - Load performance statistics enabled.
2013-08-14 08:30:36,899 [tpServer.main()] INFO  DefaultCamelContext           
- Total 1 routes, of which 1 is started.
2013-08-14 08:30:36,900 [tpServer.main()] INFO  DefaultCamelContext           
- Apache Camel 2.11.1 (CamelContext: camel-1) started in 0.295 seconds
2013-08-14 08:30:37,921 [vice.sad.it:21/] INFO  FtpConsumer                   
- Connected and logged in to: ftp://xxxx@xx.xx.com:21
2013-08-14 08:30:38,439 [vice.sad.it:21/] INFO  route1                        
- Downloaded file PNEUS_NUOVO.csv complete.
2013-08-14 08:30:38,492 [vice.sad.it:21/] INFO  route1                        
- Downloaded file SAD_Export_20100803_3.txt complete.
2013-08-14 08:30:38,552 [vice.sad.it:21/] INFO  route1                        
- Downloaded file SAD_Export_20100901_4.txt complete.
2013-08-14 08:30:38,577 [vice.sad.it:21/] INFO  route1                        
- Downloaded file SAD_Export_20100901_5.txt complete.



Writing my own class with  CamelContext add route ( coping all from example
)  and start context nothing happens.

CamelContext camelContext = DefaultCamelContext(jndiRegistry);
camelContext.addRoutes(new ConfigRoutes());
camelContext.start();

14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess:
it.sad.lib.batch.ProcessHandler : started
14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess: Start: 2013-08-14
09:54:32
14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
(CamelContext: camel-1) is starting
14-08-2013 09:54:33 INFO  [main] ManagementStrategyFactory: JMX enabled.
14-08-2013 09:54:33 INFO  [main] DefaultTypeConverter: Loaded 172 type
converters
14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Route: route1 started
and consuming from:
Endpoint[ftp://service.sad.it:21/?password=******&username=xxxt]
14-08-2013 09:54:33 INFO  [main] DefaultManagementLifecycleStrategy: Load
performance statistics enabled.
14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Total 1 routes, of
which 1 is started.
14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
(CamelContext: camel-1) started in 0.375 seconds
14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess: End: 2013-08-14
09:54:33, elapsed seconds 1.
14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
(CamelContext: camel-1) is shutting down
14-08-2013 09:54:33 INFO  [main] DefaultShutdownStrategy: Starting to
graceful shutdown 1 routes (timeout 300 seconds)
14-08-2013 09:54:33 INFO  [Camel (camel-1) thread #2 - ShutdownTask]
DefaultShutdownStrategy: Route: route1 shutdown complete, was consuming
from: Endpoint[ftp://xx.xx.com:21/?password=******&username=xxx]
14-08-2013 09:54:33 INFO  [main] DefaultShutdownStrategy: Graceful shutdown
of 1 routes completed in 0 seconds
14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
(CamelContext: camel-1) uptime 0.385 seconds
14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
(CamelContext: camel-1) is shutdown in 0.008 seconds




Looking the example class, there is used  org.apache.camel.main.Main.

What i must do, that my class starts the download ?







--
View this message in context: http://camel.465427.n5.nabble.com/ftp-component-no-download-tp5737232.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ftp component, no download

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

Invoking start on the CamelContext is a non-blocking call, check links below
to see how to keep your standalone Camel application running:

http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
http://stackoverflow.com/questions/1846791/camelcontext-start-doesnt-block

Babak


kalber wrote
> Hi,
> 
> i'm using the ftp server example with my server, user.. and it works.
> Below the output :
> 
> [INFO] --- exec-maven-plugin:1.1.1:java (default-cli) @ camel-example-ftp
> ---
> 2013-08-14 08:30:36,422 [tpServer.main()] INFO  MainSupport                   
> - Apache Camel 2.11.1 starting
> *********************************************************************************
> Camel will route files from the FTP server:
> ftp://xx.xx.com:21/?username=xxx&password=xxxx&delay=5s to the
> target/download directory.
> You can configure the location of the ftp server in the
> src/main/resources/ftp.properties file.
> Use ctrl + c to stop this application.
> *********************************************************************************
> 2013-08-14 08:30:36,604 [tpServer.main()] INFO  DefaultCamelContext           
> - Apache Camel 2.11.1 (CamelContext: camel-1) is starting
> 2013-08-14 08:30:36,657 [tpServer.main()] INFO  ManagementStrategyFactory     
> - JMX enabled.
> 2013-08-14 08:30:36,736 [tpServer.main()] INFO  DefaultTypeConverter          
> - Loaded 172 type converters
> 2013-08-14 08:30:36,896 [tpServer.main()] INFO  DefaultCamelContext           
> - Route: route1 started and consuming from:
> Endpoint[ftp://service.sad.it:21/?delay=5s&password=******&username=xxxx]
> 2013-08-14 08:30:36,896 [tpServer.main()] INFO 
> ultManagementLifecycleStrategy - Load performance statistics enabled.
> 2013-08-14 08:30:36,899 [tpServer.main()] INFO  DefaultCamelContext           
> - Total 1 routes, of which 1 is started.
> 2013-08-14 08:30:36,900 [tpServer.main()] INFO  DefaultCamelContext           
> - Apache Camel 2.11.1 (CamelContext: camel-1) started in 0.295 seconds
> 2013-08-14 08:30:37,921 [vice.sad.it:21/] INFO  FtpConsumer                   
> - Connected and logged in to: ftp://xxxx@xx.xx.com:21
> 2013-08-14 08:30:38,439 [vice.sad.it:21/] INFO  route1                        
> - Downloaded file PNEUS_NUOVO.csv complete.
> 2013-08-14 08:30:38,492 [vice.sad.it:21/] INFO  route1                        
> - Downloaded file SAD_Export_20100803_3.txt complete.
> 2013-08-14 08:30:38,552 [vice.sad.it:21/] INFO  route1                        
> - Downloaded file SAD_Export_20100901_4.txt complete.
> 2013-08-14 08:30:38,577 [vice.sad.it:21/] INFO  route1                        
> - Downloaded file SAD_Export_20100901_5.txt complete.
> 
> 
> 
> Writing my own class with  CamelContext add route ( coping all from
> example )  and start context nothing happens.
> 
> CamelContext camelContext = DefaultCamelContext(jndiRegistry);
> camelContext.addRoutes(new ConfigRoutes());
> camelContext.start();
> 
> 14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess:
> it.sad.lib.batch.ProcessHandler : started
> 14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess: Start: 2013-08-14
> 09:54:32
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) is starting
> 14-08-2013 09:54:33 INFO  [main] ManagementStrategyFactory: JMX enabled.
> 14-08-2013 09:54:33 INFO  [main] DefaultTypeConverter: Loaded 172 type
> converters
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Route: route1
> started and consuming from:
> Endpoint[ftp://service.sad.it:21/?password=******&username=xxxt]
> 14-08-2013 09:54:33 INFO  [main] DefaultManagementLifecycleStrategy: Load
> performance statistics enabled.
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Total 1 routes, of
> which 1 is started.
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) started in 0.375 seconds
> 14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess: End: 2013-08-14
> 09:54:33, elapsed seconds 1.
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) is shutting down
> 14-08-2013 09:54:33 INFO  [main] DefaultShutdownStrategy: Starting to
> graceful shutdown 1 routes (timeout 300 seconds)
> 14-08-2013 09:54:33 INFO  [Camel (camel-1) thread #2 - ShutdownTask]
> DefaultShutdownStrategy: Route: route1 shutdown complete, was consuming
> from: Endpoint[ftp://xx.xx.com:21/?password=******&username=xxx]
> 14-08-2013 09:54:33 INFO  [main] DefaultShutdownStrategy: Graceful
> shutdown of 1 routes completed in 0 seconds
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) uptime 0.385 seconds
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) is shutdown in 0.008 seconds
> 
> 
> 
> 
> Looking the example class, there is used  org.apache.camel.main.Main.
> 
> What i must do, that my class starts the download ?





--
View this message in context: http://camel.465427.n5.nabble.com/ftp-component-no-download-tp5737232p5737234.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ftp component, no download

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You need to keep your standalone application running.

See
http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html

The start method on camelContext is not blocking. So you can use the
Main class, or use other means of keeping the app running.

On Wed, Aug 14, 2013 at 9:57 AM, kalber <Ka...@swslt.com> wrote:
> Hi,
>
> i'm using the ftp server example with my server, user.. and it works. Below
> the output :
>
> [INFO] --- exec-maven-plugin:1.1.1:java (default-cli) @ camel-example-ftp
> ---
> 2013-08-14 08:30:36,422 [tpServer.main()] INFO  MainSupport
> - Apache Camel 2.11.1 starting
> *********************************************************************************
> Camel will route files from the FTP server:
> ftp://xx.xx.com:21/?username=xxx&password=xxxx&delay=5s to the
> target/download directory.
> You can configure the location of the ftp server in the
> src/main/resources/ftp.properties file.
> Use ctrl + c to stop this application.
> *********************************************************************************
> 2013-08-14 08:30:36,604 [tpServer.main()] INFO  DefaultCamelContext
> - Apache Camel 2.11.1 (CamelContext: camel-1) is starting
> 2013-08-14 08:30:36,657 [tpServer.main()] INFO  ManagementStrategyFactory
> - JMX enabled.
> 2013-08-14 08:30:36,736 [tpServer.main()] INFO  DefaultTypeConverter
> - Loaded 172 type converters
> 2013-08-14 08:30:36,896 [tpServer.main()] INFO  DefaultCamelContext
> - Route: route1 started and consuming from:
> Endpoint[ftp://service.sad.it:21/?delay=5s&password=******&username=xxxx]
> 2013-08-14 08:30:36,896 [tpServer.main()] INFO
> ultManagementLifecycleStrategy - Load performance statistics enabled.
> 2013-08-14 08:30:36,899 [tpServer.main()] INFO  DefaultCamelContext
> - Total 1 routes, of which 1 is started.
> 2013-08-14 08:30:36,900 [tpServer.main()] INFO  DefaultCamelContext
> - Apache Camel 2.11.1 (CamelContext: camel-1) started in 0.295 seconds
> 2013-08-14 08:30:37,921 [vice.sad.it:21/] INFO  FtpConsumer
> - Connected and logged in to: ftp://xxxx@xx.xx.com:21
> 2013-08-14 08:30:38,439 [vice.sad.it:21/] INFO  route1
> - Downloaded file PNEUS_NUOVO.csv complete.
> 2013-08-14 08:30:38,492 [vice.sad.it:21/] INFO  route1
> - Downloaded file SAD_Export_20100803_3.txt complete.
> 2013-08-14 08:30:38,552 [vice.sad.it:21/] INFO  route1
> - Downloaded file SAD_Export_20100901_4.txt complete.
> 2013-08-14 08:30:38,577 [vice.sad.it:21/] INFO  route1
> - Downloaded file SAD_Export_20100901_5.txt complete.
>
>
>
> Writing my own class with  CamelContext add route ( coping all from example
> )  and start context nothing happens.
>
> CamelContext camelContext = DefaultCamelContext(jndiRegistry);
> camelContext.addRoutes(new ConfigRoutes());
> camelContext.start();
>
> 14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess:
> it.sad.lib.batch.ProcessHandler : started
> 14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess: Start: 2013-08-14
> 09:54:32
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) is starting
> 14-08-2013 09:54:33 INFO  [main] ManagementStrategyFactory: JMX enabled.
> 14-08-2013 09:54:33 INFO  [main] DefaultTypeConverter: Loaded 172 type
> converters
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Route: route1 started
> and consuming from:
> Endpoint[ftp://service.sad.it:21/?password=******&username=xxxt]
> 14-08-2013 09:54:33 INFO  [main] DefaultManagementLifecycleStrategy: Load
> performance statistics enabled.
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Total 1 routes, of
> which 1 is started.
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) started in 0.375 seconds
> 14-08-2013 09:54:33 INFO  [main] ChangeTyreXXProcess: End: 2013-08-14
> 09:54:33, elapsed seconds 1.
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) is shutting down
> 14-08-2013 09:54:33 INFO  [main] DefaultShutdownStrategy: Starting to
> graceful shutdown 1 routes (timeout 300 seconds)
> 14-08-2013 09:54:33 INFO  [Camel (camel-1) thread #2 - ShutdownTask]
> DefaultShutdownStrategy: Route: route1 shutdown complete, was consuming
> from: Endpoint[ftp://xx.xx.com:21/?password=******&username=xxx]
> 14-08-2013 09:54:33 INFO  [main] DefaultShutdownStrategy: Graceful shutdown
> of 1 routes completed in 0 seconds
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) uptime 0.385 seconds
> 14-08-2013 09:54:33 INFO  [main] DefaultCamelContext: Apache Camel 2.11.1
> (CamelContext: camel-1) is shutdown in 0.008 seconds
>
>
>
>
> Looking the example class, there is used  org.apache.camel.main.Main.
>
> What i must do, that my class starts the download ?
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ftp-component-no-download-tp5737232.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: ftp component, no download

Posted by Babak Vahdat <ba...@swissonline.ch>.
In contrast to your first route (which consumes from the FTP endpoint) this
second route of yours does *not* own a polling consumer:

http://camel.apache.org/polling-consumer.html

So in this case you have to invoke your route (synchronously), through a
producer template or another route, etc.. So that the JVM keeps running
until this call returns at which point a row has been already inserted into
your db.

Babak 


kalber wrote
> ok, i understand
> 
> but i use camelContext  with start  so for sql component e.g.
> 
> 		from("direct:infor.insert.ipnl_passages")
> 				.to("sql:insert into cust_ipnl_passages
> (ID,DT_CRT,FLAG_TO_DUPLICAT,FLAG_TO_REDIRECT,LINE_CODE,RUN_CODE,COM_CODE,COMPANY_CODE,DT_SCHED,DT_DEL,SII_CODE,SOLARI_CODE,HOSTNAME,LOCATION,DEV_TYPE,DEV_GROUP,TERMINUS_SII_CODE,TERMINUS_SII_CODE_DEST,TERMINUS_PROVIDER_DEST,DESTINATION,PASSAGE_COUNT,DIRECTION,DESTINATION_SOURCE,TIME_TABLE_ID,DT_START,DT_TERM,SII_CODE_START,
> FLAG_IN_SERVICE, COM_CODE_NORMALIZED, DT_PROCESS) values (sys_guid(),
> sysdate,#,#,#,#,#,#,to_date(#,'yyyy-mm-dd
> hh24:mi-ss'),to_date(#,'yyyy-mm-dd
> hh24:mi-ss'),#,#,#,#,#,#,#,#,#,#,#,#,#,#,to_date(#,'yyyy-mm-dd
> hh24:mi-ss'),to_date(#,'yyyy-mm-dd
> hh24:mi-ss'),#,#,#,to_date(#,'yyyy-mm-dd
> hh24:mi-ss'))?dataSource=#dataSource.infor&batch=true");
> 
> and it works fine.
> 
> So it depends on the component whether will executed sequentially ?





--
View this message in context: http://camel.465427.n5.nabble.com/ftp-component-no-download-tp5737232p5737241.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ftp component, no download

Posted by kalber <Ka...@swslt.com>.
ok, i understand

but i use camelContext  with start  so for sql component e.g.

		from("direct:infor.insert.ipnl_passages")
				.to("sql:insert into cust_ipnl_passages
(ID,DT_CRT,FLAG_TO_DUPLICAT,FLAG_TO_REDIRECT,LINE_CODE,RUN_CODE,COM_CODE,COMPANY_CODE,DT_SCHED,DT_DEL,SII_CODE,SOLARI_CODE,HOSTNAME,LOCATION,DEV_TYPE,DEV_GROUP,TERMINUS_SII_CODE,TERMINUS_SII_CODE_DEST,TERMINUS_PROVIDER_DEST,DESTINATION,PASSAGE_COUNT,DIRECTION,DESTINATION_SOURCE,TIME_TABLE_ID,DT_START,DT_TERM,SII_CODE_START,
FLAG_IN_SERVICE, COM_CODE_NORMALIZED, DT_PROCESS) values (sys_guid(),
sysdate,#,#,#,#,#,#,to_date(#,'yyyy-mm-dd hh24:mi-ss'),to_date(#,'yyyy-mm-dd
hh24:mi-ss'),#,#,#,#,#,#,#,#,#,#,#,#,#,#,to_date(#,'yyyy-mm-dd
hh24:mi-ss'),to_date(#,'yyyy-mm-dd hh24:mi-ss'),#,#,#,to_date(#,'yyyy-mm-dd
hh24:mi-ss'))?dataSource=#dataSource.infor&batch=true");

and it works fine.

So it depends on the component whether will executed sequentially ?



--
View this message in context: http://camel.465427.n5.nabble.com/ftp-component-no-download-tp5737232p5737238.html
Sent from the Camel - Users mailing list archive at Nabble.com.