Верблюжий маршрут для загрузки на S3 не удается - PullRequest
0 голосов
/ 13 февраля 2020

Я пытаюсь построить базовый маршрут c, который обнаруживает файл .csv и загружает его в мое хранилище S3.

CSV-файл получает географическую привязку, и маршрут работает, за исключением части .to ("aws -s3 ...").

Я пробовал решение из этого вопроса , но оно не удалось.

Мой маршрут:

public class CsvToS3Route extends RouteBuilder {
@Override
public void configure() throws Exception {
    from("file:./src/main/resources/mycsvfilesfolder?filterFile=${file:name.ext.single} =~ 'csv'")
            .convertBodyTo(byte[].class)
            .setHeader(S3Constants.CONTENT_LENGTH, simple("${in.header.CamelFileLength}"))
            .setHeader(S3Constants.KEY,simple("${in.header.CamelFileNameOnly}"))
            .to("aws-s3://my-bucket?deleteAfterWrite=false&region=eu-west-1&accessKey=mypublickey&secretKey=RAW(mysecretkey)")
            .log("done.");
}}

Мой основной класс:

@Component
  public class CamelRoutes {
  Logger logger = LoggerFactory.getLogger(CamelRoutes.class);
  private Main main;
  private CamelContext context;

  @Bean
  public void run() throws Exception {
      this.main = new Main();
      this.context = new DefaultCamelContext(registry);
      context.addRoutes(new CsvToS3Route());

      main.getCamelContexts().clear();
      main.getCamelContexts().add(context);

      // Run Camel forever
      logger.info("Starting Camel Application");
      main.setDuration(-1);
      main.run();
  }}

Ошибка

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.apache.camel.support.DefaultComponent.doStart(DefaultComponent.java:245)

The following method did not exist:

    org.apache.camel.CamelContext.getPropertiesComponent(Z)Lorg/apache/camel/spi/PropertiesComponent;

The method's class, org.apache.camel.CamelContext, is available from the following locations:

    jar:file:/Users/myuser/.gradle/caches/modules-2/files-2.1/org.apache.camel/camel-core/2.23.2.fuse-750029-redhat-00001/93a0f16a539d46373c121d4b10cd9fc844c8779a/camel-core-2.23.2.fuse-750029-redhat-00001.jar!/org/apache/camel/CamelContext.class
    jar:file:/Users/myuser/.gradle/caches/modules-2/files-2.1/org.apache.camel/camel-api/3.0.0-M2/7724c277b1f57116083c555ccb3bfd63a4e74ea0/camel-api-3.0.0-M2.jar!/org/apache/camel/CamelContext.class

It was loaded from the following location:

    file:/Users/myuser/.gradle/caches/modules-2/files-2.1/org.apache.camel/camel-core/2.23.2.fuse-750029-redhat-00001/93a0f16a539d46373c121d4b10cd9fc844c8779a/camel-core-2.23.2.fuse-750029-redhat-00001.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.apache.camel.CamelContext

2020-02-13 12:53:28.898  INFO 31954 --- [ngupInterceptor] o.a.c.m.MainSupport$HangupInterceptor    : Received hang up - stopping the main instance.
2020-02-13 12:53:28.899  INFO 31954 --- [ngupInterceptor] o.apache.camel.impl.DefaultCamelContext  : Apache Camel 2.23.2.fuse-750029-redhat-00001 (CamelContext: camel-1) is shutting down
2020-02-13 12:53:28.911  INFO 31954 --- [ngupInterceptor] o.apache.camel.impl.DefaultCamelContext  : Apache Camel 2.23.2.fuse-750029-redhat-00001 (CamelContext: camel-1) uptime 0.213 seconds
2020-02-13 12:53:28.911  INFO 31954 --- [ngupInterceptor] o.apache.camel.impl.DefaultCamelContext  : Apache Camel 2.23.2.fuse-750029-redhat-00001 (CamelContext: camel-1) is shutdown in 0.012 seconds

Process finished with exit code 1

Что-то мне не хватает?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...