context.getShutdownStrategy().setTimeout(getShutdownTimeout());
@Override public void configure() throws Exception { // configure properties component PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class); pc.setLocation("classpath:ftp.properties"); // lets shutdown faster in case of in-flight messages stack up getContext().getShutdownStrategy().setTimeout(10); from("{{ftp.server}}") .to("file:target/download") .log("Downloaded file ${file:name} complete."); // use system out so it stand out System.out.println("*********************************************************************************"); System.out.println("Camel will route files from the FTP server: " + getContext().resolvePropertyPlaceholders("{{ftp.server}}") + " to the target/download directory."); System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file."); System.out.println("Use ctrl + c to stop this application."); System.out.println("*********************************************************************************"); } }
@Override public void configure() throws Exception { // configure properties component PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class); pc.setLocation("classpath:ftp.properties"); // lets shutdown faster in case of in-flight messages stack up getContext().getShutdownStrategy().setTimeout(10); from("file:target/upload?moveFailed=../error") .log("Uploading file ${file:name}") .to("{{ftp.client}}") .log("Uploaded file ${file:name} complete."); // use system out so it stand out System.out.println("*********************************************************************************"); System.out.println("Camel will route files from target/upload directory to the FTP server: " + getContext().resolvePropertyPlaceholders("{{ftp.server}}")); System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file."); System.out.println("If the file upload fails, then the file is moved to the target/error directory."); System.out.println("Use ctrl + c to stop this application."); System.out.println("*********************************************************************************"); } }
this.context.getShutdownStrategy().setTimeout(10); this.context.getShutdownStrategy().setTimeUnit(TimeUnit.SECONDS);
@Override public void configure() throws Exception { // lets shutdown quicker getContext().getShutdownStrategy().setTimeout(10); // configure the kafka component to use the broker KafkaComponent kafka = new KafkaComponent(); // you can specify more brokers separated by comma kafka.setBrokers("localhost:9092"); // add component to CamelContext getContext().addComponent("kafka", kafka); // use a timer to trigger every 100 milli seconds and generate a random word // which is sent to kafka from("timer:foo?period=100") .bean(new WordBean()) .to("kafka:words") .to("log:words?groupInterval=1000"); } }