PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class); Properties extra = useOverridePropertiesWithPropertiesComponent(); if (extra != null && !extra.isEmpty()) {
@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("*********************************************************************************"); } }
final Component component = context.getComponent(componentName); HandlerCustomizer.customizeComponent(context, connector, descriptor, component, new HashMap<>(properties));
@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("*********************************************************************************"); } }
@Override public void configure() throws Exception { // use vertx instance on the Camel vertx component getContext().getComponent("vertx", VertxComponent.class).setVertx(vertx); // initialize the list of games which is called when a new client connects to Vert.X backend from("direct:init-games").routeId("init-games") .log("Init games event") .to("goal:games.csv") // the frontend expect one message per game so split .split(body()) .to("vertx:games"); // the route for handling live score updates from the goal // component which is published to vertx addresses from("goal:goals.csv").routeId("livescore").autoStartup(false) .log("Goal event: ${header.action} -> ${body}") .choice() .when(header("action").isEqualTo("clock")) .to("vertx:clock") .when(header("action").isEqualTo("goal")) .to("vertx:goals"); // consume from vertx control address when the user clicks the control buttons // then we want to start/suspend the livescore route accordingly from("vertx:control").routeId("control") .log("Control event: ${body}") .toD("controlbus:route?routeId=livescore&async=true&action=${body}"); }