|
10.05.2012, 06:15:06
#37787187
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
Ссылка на профиль пользователя:
|
|
|
Участник
Откуда: Владивосток
Сообщения: 393
Рейтинг:
0
/ 0
|
|
|
|
Есть код который соединяется с сервером через FTPS и успешно скачивает файлик. Мне нужно тоже самое но с использованием Camel. В Camel я нуб, поэтому просьба сильно не пинать.
Думаю, что нет необходимости выкладывать код обычного подключения через FTPS. А вот код подключения через Camel:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.
@Test
public void testDirectEndpointFrom4Oaks() throws Exception {
RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("ftps://666.66.666.66:990/FOLDER1/file.txt?username=username&password=password&securityProtocol=SSL&isImplicit=true&passiveMode=true&execProt=P&execPbsz=0")
.to("file://target/test-reports666");
}
};
builder.getContext().start();
Thread.sleep(5000);
builder.getContext().stop();
}
Вот спринговый конфиг:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
<routeContext id="orderRoute" xmlns="http://camel.apache.org/schema/spring">
<route id="ftpsImplicit990">
<from uri="ftps://666.66.666.66:990/FOLDER1/file.txt?username=username&password=password"/>
<to uri="file://target/test-reports666"/>
</route>
</routeContext>
<camelContext id="com.nxsystems.camel" xmlns="http://camel.apache.org/schema/spring">
<routeContextRef ref="orderRoute"/>
</camelContext>
лог:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30.
"11:31:53,405 INFO (main) [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [OrderRoute.xml]
11:31:53,615 INFO (main) [CamelNamespaceHandler] camel-osgi.jar/camel-spring-osgi.jar not detected in classpath
11:31:54,107 INFO (main) [GenericApplicationContext] Refreshing org.springframework.context.support.GenericApplicationContext@913fe2: startup date [Thu May 10 11:31:54 VLAT 2012]; root of context hierarchy
11:31:54,228 INFO (main) [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ee3aa7: defining beans [orderValidator,orderProcessor,exceptionProcessor,responsePublisher,orderRoute,template,consumerTemplate,com.nxsystems.camel:beanPostProcessor,com.nxsystems.camel,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor]; root of factory hierarchy
11:31:54,302 INFO (main) [DefaultCamelContext] Apache Camel 2.3.0 (CamelContext: com.nxsystems.camel) is starting
11:31:54,303 INFO (main) [DefaultCamelContext] JMX enabled. Using ManagedManagementStrategy.
11:31:54,786 INFO (main) [AnnotationTypeConverterLoader] Found 4 packages with 14 @Converter classes to load
11:31:54,804 INFO (main) [DefaultTypeConverter] Loaded 142 type converters in 350 millis
11:31:55,149 INFO (main) [DefaultCamelContext] Route: ftpsImplicit990 started and consuming from: Endpoint[ftps://666.66.666.66:990/FOLDER1/file.txt?username=username&password=password]
11:31:55,149 INFO (main) [DefaultCamelContext] Route: qwe1 started and consuming from: Endpoint[direct://point0]
11:31:55,150 INFO (main) [DefaultCamelContext] Started 2 routes
11:31:55,150 INFO (main) [DefaultCamelContext] Apache Camel 2.3.0 (CamelContext: com.nxsystems.camel) started in 848 millis
11:31:55,166 INFO (main) [DefaultCamelContext] Apache Camel 2.3.0 (CamelContext: camel-2) is starting
11:31:55,167 INFO (main) [DefaultCamelContext] JMX enabled. Using ManagedManagementStrategy.
11:31:55,427 INFO (main) [AnnotationTypeConverterLoader] Found 4 packages with 14 @Converter classes to load
11:31:55,432 INFO (main) [DefaultTypeConverter] Loaded 142 type converters in 254 millis
11:31:55,441 INFO (main) [DefaultCamelContext] Started 0 routes
11:31:55,441 INFO (main) [DefaultCamelContext] Apache Camel 2.3.0 (CamelContext: camel-2) started in 275 millis
11:32:00,443 INFO (main) [DefaultCamelContext] Apache Camel 2.3.0 (CamelContext:camel-2) is shutting down
11:32:00,443 INFO (main) [DefaultShutdownStrategy] Starting to graceful shutdown 0 routes (timeout 300 seconds)
11:32:00,448 INFO (main) [DefaultShutdownStrategy] Graceful shutdown of 0 routes completed in 0 seconds
11:32:00,449 INFO (main) [DefaultInflightRepository] Shutting down with no inflight exchanges.
11:32:00,450 INFO (main) [DefaultCamelContext] Apache Camel 2.3.0 (CamelContext: camel-2) is shutdown in 7 millis
11:32:00,455 INFO (Thread-1) [GenericApplicationContext] Closing org.springframework.context.support.GenericApplicationContext@913fe2: startup date [Thu May 10 11:31:54 VLAT 2012]; root of context hierarchy
11:32:00,456 INFO (Thread-1) [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ee3aa7: defining beans [orderValidator,orderProcessor,exceptionProcessor,responsePublisher,orderRoute,template,consumerTemplate,com.nxsystems.camel:beanPostProcessor,com.nxsystems.camel,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor]; root of factory hierarchy
11:32:00,460 INFO (Thread-1) [DefaultCamelContext] Apache Camel 2.3.0 (CamelContext:com.nxsystems.camel) is shutting down
11:32:00,461 INFO (Thread-1) [DefaultShutdownStrategy] Starting to graceful shutdown 2 routes (timeout 300 seconds)
11:32:00,463 INFO (Camel Thread 2 - ShutdownTask) [DefaultShutdownStrategy] Route: qwe1 shutdown deferred.
11:32:00,463 INFO (Camel Thread 2 - ShutdownTask) [DefaultShutdownStrategy] Route: ftpsImplicit990 suspended and shutdown deferred, was consuming from: Endpoint[ftps://666.66.666.66:990/FOLDER1/file.txt?username=username&password=password]
11:32:00,464 INFO (Camel Thread 2 - ShutdownTask) [DefaultShutdownStrategy] Route: qwe1 shutdown complete.
Для обычного фтп все работает норм:
1. 2.
from("ftp://ftp.mozilla.org/pub/README?binary=true").
to("file://target/test-reports123");
|
|
|