private void addDTSIncomingFileRouter(final CamelContext context) throws Exception {
    final CIAOConfig config = CamelApplication.getConfig(context);
    final DTSIncomingFileRouterRoute route = new DTSIncomingFileRouterRoute();

    // IN folder properties
    route.setDTSInUri(context.resolvePropertyPlaceholders("file://{{dts.rootFolder}}/IN"));
    route.setDTSMessageReceiverUri("direct:dtsMessageReceiver");
    route.setInIdempotentRepositoryId("dtsReceiverIdempotentRepository");
    route.setInInProgressRepositoryId("dtsReceiverInProgressRepository");

    // SEND folder properties
    route.setDTSSentUri(context.resolvePropertyPlaceholders("file://{{dts.rootFolder}}/SENT"));
    route.setDTSMessageSendNotificationReceiverUri("direct:dtsMessageSendNotificationReceiver");
    route.setSentIdempotentRepositoryId("dtsSentIdempotentRepository");
    route.setSentInProgressRepositoryId("dtsSentInProgressRepository");
    route.setDTSFilePrefix(Strings.nullToEmpty(config.getConfigValue("dts.filePrefix")));

    // common properties
    route.setMailboxes(Arrays.asList(config.getConfigValue("dts.senderMailbox")));

    final Set<String> workflowIds = Sets.newHashSet(config.getConfigValue("dts.workflowId"));
    for (final String workflowId : config.getConfigValue("dts.receiverWorkflowIds").split(",")) {
      if (!workflowId.trim().isEmpty()) {
        workflowIds.add(workflowId);
      }
    }
    route.setWorkflowIds(workflowIds);

    context.addRoutes(route);
  }
예제 #2
0
  public static void main(String[] args) throws Exception {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("integration.xml");

    CamelContext context = (CamelContext) ctx.getBean("camelContext");

    ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
    context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(cf));
    context.addRoutes(
        new RouteBuilder() {

          public void configure() {
            from("jms:queue:spring-tweets")
                .process(
                    new Processor() {
                      public void process(Exchange e) {
                        System.out.println("Message: " + e.getIn().getBody());

                        Tweet tweet = (Tweet) e.getIn().getBody();
                        System.out.println("Sender: " + tweet.getFromUser());
                        System.out.println("Text: " + tweet.getText());
                      }
                    });
          }
        });
    context.start();

    while (true) {}
  }
  public void createRouteToDeliverImpexToHotfolder(final String inputQueue, final String outputDest)
      throws Exception {

    final RouteBuilder builder =
        new RouteBuilder() {
          public void configure() {
            from(inputQueue).to(outputDest);
          }
        };
    builder
        .onException(Throwable.class)
        .maximumRedeliveries(2)
        .maximumRedeliveryDelay(1000)
        .multicast()
        .to(DELIVERY_DEAD_LETTER_QUEUE)
        .process(
            new Processor() {
              @Override
              public void process(Exchange exchange) throws Exception {
                Throwable caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
                StringWriter sw = new StringWriter();
                caused.printStackTrace(new PrintWriter(sw));
                exchange.getIn().setBody(sw.toString());
                exchange.getIn().setHeader("Subject", "Delivery impex file failed");
                exchange.getContext().createProducerTemplate().send(SEND_EMAIL_QUEUE, exchange);
              }
            });

    context.addRoutes(builder);
  }
예제 #4
0
 private boolean addRouteToContext(
     Bean<?> routeBean, Bean<?> contextBean, BeanManager manager, AfterDeploymentValidation adv) {
   try {
     CamelContext context = getReference(manager, CamelContext.class, contextBean);
     try {
       Object route = getReference(manager, Object.class, routeBean);
       if (route instanceof RoutesBuilder) {
         context.addRoutes((RoutesBuilder) route);
       } else if (route instanceof RouteContainer) {
         context.addRouteDefinitions(((RouteContainer) route).getRoutes());
       } else {
         throw new IllegalArgumentException(
             "Invalid routes type ["
                 + routeBean.getBeanClass().getName()
                 + "], "
                 + "must be either of type RoutesBuilder or RouteContainer!");
       }
       return true;
     } catch (Exception cause) {
       adv.addDeploymentProblem(
           new InjectionException(
               "Error adding routes of type ["
                   + routeBean.getBeanClass().getName()
                   + "] "
                   + "to Camel context ["
                   + context.getName()
                   + "]",
               cause));
     }
   } catch (Exception exception) {
     adv.addDeploymentProblem(exception);
   }
   return false;
 }
예제 #5
0
 protected void postProcessCamelContext(CamelContext camelContext) throws Exception {
   // try to load the route builders from the routeBuilderClasses
   loadRouteBuilders(camelContext);
   for (RouteBuilder routeBuilder : routeBuilders) {
     camelContext.addRoutes(routeBuilder);
   }
 }
  @Test
  public void testSqlIdempotentConsumer() throws Exception {
    Assert.assertNotNull("DataSource not null", dataSource);

    final JdbcMessageIdRepository jdbcMessageIdRepository =
        new JdbcMessageIdRepository(dataSource, "myProcessorName");

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("direct:start")
                .idempotentConsumer(simple("${header.messageId}"), jdbcMessageIdRepository)
                .to("mock:result");
          }
        });

    camelctx.start();
    try {
      MockEndpoint mockEndpoint = camelctx.getEndpoint("mock:result", MockEndpoint.class);
      mockEndpoint.expectedMessageCount(1);

      // Send 5 messages with the same messageId header. Only 1 should be forwarded to the
      // mock:result endpoint
      ProducerTemplate template = camelctx.createProducerTemplate();
      for (int i = 0; i < 5; i++) {
        template.requestBodyAndHeader("direct:start", null, "messageId", "12345");
      }

      mockEndpoint.assertIsSatisfied();
    } finally {
      camelctx.stop();
    }
  }
  @Test
  public void testSQLEndpoint() throws Exception {
    Assert.assertNotNull("DataSource not null", dataSource);

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("sql:select name from information_schema.users?dataSource=java:jboss/datasources/ExampleDS")
                .to("direct:end");
          }
        });

    camelctx.start();
    try {
      PollingConsumer pollingConsumer = camelctx.getEndpoint("direct:end").createPollingConsumer();
      pollingConsumer.start();

      String result = (String) pollingConsumer.receive().getIn().getBody(Map.class).get("NAME");
      Assert.assertEquals("SA", result);
    } finally {
      camelctx.stop();
    }
  }
  @Test
  public void testInvalidCredentials() throws Exception {
    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("direct:start")
                .policy(new DomainAuthorizationPolicy())
                .transform(body().prepend("Hello "));
          }
        });

    camelctx.start();
    try {
      ProducerTemplate producer = camelctx.createProducerTemplate();
      try {
        Subject subject = getAuthenticationToken("user-domain", AnnotatedSLSB.USERNAME, "bogus");
        producer.requestBodyAndHeader(
            "direct:start", "Kermit", Exchange.AUTHENTICATION, subject, String.class);
        Assert.fail("CamelExecutionException expected");
      } catch (CamelExecutionException e) {
        // expected
      }
    } finally {
      camelctx.stop();
    }
  }
  @Test
  public void testEndpointClass() throws Exception {

    final CountDownLatch latch = new CountDownLatch(3);

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("quartz2://mytimer?trigger.repeatCount=3&trigger.repeatInterval=100")
                .process(
                    new Processor() {
                      @Override
                      public void process(Exchange exchange) throws Exception {
                        latch.countDown();
                      }
                    })
                .to("mock:result");
          }
        });

    camelctx.start();
    try {
      Assert.assertTrue("Countdown reached zero", latch.await(500, TimeUnit.MILLISECONDS));
    } finally {
      camelctx.stop();
    }
  }
  @Test
  public void testNoAuthenticationHeader() throws Exception {
    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("direct:start")
                .policy(new DomainAuthorizationPolicy())
                .transform(body().prepend("Hello "));
          }
        });

    camelctx.start();
    try {
      ProducerTemplate producer = camelctx.createProducerTemplate();
      try {
        producer.requestBody("direct:start", "Kermit", String.class);
        Assert.fail("CamelExecutionException expected");
      } catch (CamelExecutionException e) {
        // expected
      }
    } finally {
      camelctx.stop();
    }
  }
  @Test
  public void testRoleBasedAccess() throws Exception {
    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("direct:start")
                .policy(new DomainAuthorizationPolicy().roles("Role2"))
                .transform(body().prepend("Hello "));
          }
        });

    camelctx.start();
    try {
      ProducerTemplate producer = camelctx.createProducerTemplate();
      Subject subject =
          getAuthenticationToken("user-domain", AnnotatedSLSB.USERNAME, AnnotatedSLSB.PASSWORD);
      String result =
          producer.requestBodyAndHeader(
              "direct:start", "Kermit", Exchange.AUTHENTICATION, subject, String.class);
      Assert.assertEquals("Hello Kermit", result);
    } finally {
      camelctx.stop();
    }
  }
  /**
   * @param args
   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    CamelContext context = new DefaultCamelContext();

    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm:/localhost");
    context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

    context.addRoutes(
        new RouteBuilder() {
          public void configure() {
            from("ftp://127.0.0.1/orders?username=johnny&password=quest")
                .process(
                    new Processor() {
                      public void process(Exchange exchange) throws Exception {
                        System.out.println(
                            "\nWe just downloaded: " + exchange.getIn().getHeader("CamelFileName"));
                        System.out.println("Body:");
                        System.out.println(exchange.getIn().getBody());
                        System.out.println("\n==================\n");
                      }
                    })
                .to("jms:incomingOrders");
          }
        });

    context.start();
    Thread.sleep(60000);
    context.stop();
  }
  @Test
  public void testOgnlExpressionFromFile() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("direct:start")
                .choice()
                .when()
                .ognl("resource:classpath:test-ognl-expression.txt")
                .transform(simple("Hello ${body.name}"))
                .otherwise()
                .to("mock:dlq");
          }
        });

    Person person = new Person();
    person.setName("Kermit");

    camelctx.start();
    try {
      ProducerTemplate producer = camelctx.createProducerTemplate();
      String result = producer.requestBody("direct:start", person, String.class);
      Assert.assertEquals("Hello Kermit", result);
    } finally {
      camelctx.stop();
    }
  }
  @Test
  public void testUnmarshalJackson() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("direct:start").unmarshal().json(JsonLibrary.Jackson, Customer.class);
          }
        });

    String input = "{'firstName':'John','lastName':'Doe'}";

    camelctx.start();
    try {
      ProducerTemplate producer = camelctx.createProducerTemplate();
      Customer customer =
          producer.requestBody("direct:start", input.replace('\'', '"'), Customer.class);
      Assert.assertEquals("John", customer.getFirstName());
      Assert.assertEquals("Doe", customer.getLastName());
    } finally {
      camelctx.stop();
    }
  }
  @Test
  public void canProcessMultipleLinksWhenCommandNotKnownOnLink2() throws Exception {
    final String receiver = "*****@*****.**";
    createMailUser(receiver, "loginIdReceiver", "secretOfReceiver");

    String validSender = "*****@*****.**";
    sendMailTo(receiver).from(validSender).withSubject(anySubject()).andText("usedScenario");

    Link link1 = Links.getLink(new URI(mockURI + "?num=1&foo=bar"));
    Link link2 = Links.getLink(new URI(mockURI + "?num=2&foo=bar"));

    final String to1 =
        makeURI(
            mockURI,
            newMapBuilder()
                .put("linkparams", encode("num=1&foo=bar"))
                .put("validfroms", validSender)
                .put("scenario.usedScenario", "D11=true;A12=11")
                .build());
    final String to2 =
        makeURI(
            mockURI,
            newMapBuilder()
                .put("linkparams", encode("num=2&foo=bar"))
                .put("validfroms", validSender)
                .build());

    try {
      CamelContext context = new DefaultCamelContext();
      context.addRoutes(
          new RouteBuilder() {
            @Override
            public void configure() {
              from(localImap(receiver))
                  .multicast()
                  .setAggregationStrategy(new UseOriginalAggregationStrategy())
                  .to(to1, to2);
            }
          });
      context.start();

      waitUntilMailWasFetched();
      context.stop();

      Link mock1 = getMock(link1);
      verify(mock1).switchDigitalPin(digitalPin(11), true);
      verify(mock1).switchAnalogPin(analogPin(12), 11);
      verify(mock1).close();
      verifyNoMoreInteractions(mock1);

      Link mock2 = getMock(link2);
      verify(mock2).close();
      verifyNoMoreInteractions(mock2);
    } finally {
      link1.close();
      link2.close();
    }
  }
예제 #16
0
 /**
  * Adds a set of routing/configuration rules to the host {@link CamelContext} using the supplied
  * {@link RouteLoader}.
  *
  * @param loader The loader for the routes you wish to load.
  */
 public void load(final RouteLoader loader) {
   notNull(loader, "Route loader cannot be null.");
   try {
     log.debug("Adding routes to context {}.", hostContext.getName());
     hostContext.addRoutes(loader.load());
   } catch (Exception e) {
     throw new LifecycleException(e.getLocalizedMessage(), e);
   }
 }
예제 #17
0
 @Test(expected = FailedToCreateRouteException.class)
 public void testWrongCommand() throws Exception {
   context.addRoutes(
       new RouteBuilder() {
         @Override
         public void configure() {
           from("direct:start").to("beanstalk:default?command=noCommand");
         }
       });
 }
  public void createRouteToConvertXmlToCsv(final String queueQueue, final String outputQueue)
      throws Exception {

    final RouteBuilder builder =
        new RouteBuilder() {
          public void configure() {
            from(queueQueue).bean(Converter.class).to(outputQueue);
          }
        };
    context.addRoutes(builder);
  }
  private CamelContext createInnerContext() throws Exception {
    // Create a camel context to be encapsulated by the routebox
    JndiRegistry innerRegistry = new JndiRegistry(createJndiContext());
    BookCatalog catalogBean = new BookCatalog();
    innerRegistry.bind("library", catalogBean);

    CamelContext innerContext = new DefaultCamelContext(innerRegistry);
    innerContext.addRoutes(new SimpleRouteBuilder());

    return innerContext;
  }
  public void createRouteToSendEmails(final String fromQueue, final String toQueue)
      throws Exception {

    final RouteBuilder builder =
        new RouteBuilder() {
          public void configure() {
            from(fromQueue).to(toQueue);
          }
        };
    builder.setErrorHandlerBuilder(new DeadLetterChannelBuilder(SEND_EMAIL_DEAD_LETTER_QUEUE));
    context.addRoutes(builder);
  }
  @Test
  public void writesResultToSender() throws Exception {
    final String receiver = "*****@*****.**";
    createMailUser(receiver, "loginIdReceiver", "secretOfReceiver");

    String validSender = "*****@*****.**";
    createMailUser(validSender, "loginIdSender", "secretOfSender");
    sendMailTo(receiver).from(validSender).withSubject(anySubject()).andText("usedScenario");

    final String ardulink =
        makeURI(
            mockURI,
            newMapBuilder()
                .put("validfroms", validSender)
                .put("scenario.usedScenario", "D1=true;A2=123")
                .build());

    SmtpServer smtpd = mailMock.getSmtp();
    final String smtp =
        "smtp://"
            + smtpd.getBindTo()
            + ":"
            + smtpd.getPort()
            + "?username="******"loginIdReceiver"
            + "&password="******"secretOfReceiver"
            + "&debugMode=true";

    CamelContext context = new DefaultCamelContext();
    context.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() {
            from(localImap(receiver))
                .to(ardulink)
                .setHeader("to", simple("${in.header.from}"))
                .setHeader("from", simple("${in.header.to}"))
                .to(smtp);
          }
        });
    context.start();

    try {
      assertThat(
          ((String) fetchMail("loginIdSender", "secretOfSender").getContent()),
          is(
              "SwitchDigitalPinCommand [pin=1, value=true]=OK\r\n"
                  + "SwitchAnalogPinCommand [pin=2, value=123]=OK"));
    } finally {
      context.stop();
    }
  }
  @Before
  public void setUp() throws Exception {
    log.info("********************************************************************************");
    log.info("Testing: " + getTestMethodName() + "(" + getClass().getName() + ")");
    log.info("********************************************************************************");

    log.debug("setUp test");
    if (!useJmx()) {
      disableJMX();
    } else {
      enableJMX();
    }

    context = createCamelContext();
    assertValidContext(context);

    // reduce default shutdown timeout to avoid waiting for 300 seconds
    context.getShutdownStrategy().setTimeout(getShutdownTimeout());

    // set debugger
    context.setDebugger(new DefaultDebugger());
    context.getDebugger().addBreakpoint(breakpoint);
    // note: when stopping CamelContext it will automatic remove the breakpoint

    template = context.createProducerTemplate();
    template.start();
    consumer = context.createConsumerTemplate();
    consumer.start();

    // enable auto mocking if enabled
    String pattern = isMockEndpoints();
    if (pattern != null) {
      context.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(pattern));
    }

    postProcessTest();

    if (isUseRouteBuilder()) {
      RouteBuilder[] builders = createRouteBuilders();
      for (RouteBuilder builder : builders) {
        log.debug("Using created route builder: " + builder);
        context.addRoutes(builder);
      }
      startCamelContext();
      log.debug("Routing Rules are: " + context.getRoutes());
    } else {
      log.debug("Using route builder from the created context: " + context);
    }
    log.debug("Routing Rules are: " + context.getRoutes());
  }
  /**
   * Updated default behaviour to inject the DTS workflow details into outgoing responses
   *
   * @throws Exception
   */
  @Override
  protected void configureDistributionEnvelopeReceiverRoute(
      final CamelContext context, final DistributionEnvelopeReceiverRoute route) throws Exception {
    super.configureDistributionEnvelopeReceiverRoute(context, route);

    // have the injector pass the updated messages on to the original target route
    final DTSResponseDetailsInjectorRoute injectorRoute = new DTSResponseDetailsInjectorRoute();
    injectorRoute.setFromDistributionEnvelopeReceiverUri("direct:dts-workflow-details-injector");
    injectorRoute.setToDistributionEnvelopeSenderUri(route.getDistributionEnvelopeSenderUri());

    // Update the sender to route it's messages through the injector
    route.setDistributionEnvelopeSenderUri("direct:dts-workflow-details-injector");

    context.addRoutes(injectorRoute);
  }
예제 #24
0
  @Override
  public void deploy(Collection<RouteBuilder> routeBuilders) {
    try {
      camelContext = new DefaultCamelContext();

      camelContextCustomizers.forEach(c -> c.customize(camelContext));

      for (RouteBuilder routeBuilder : routeBuilders) {
        camelContext.addRoutes(routeBuilder);
      }
      camelContext.start();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
예제 #25
0
 private void createCamelContext() throws Exception {
   log.info("creating context and sending message");
   camelContext = new DefaultCamelContext();
   camelContext.addComponent("activemq", ActiveMQComponent.activeMQComponent(BROKER_URL));
   final String queueEndpointName = "activemq:queue" + QUEUE_NAME;
   camelContext.addRoutes(
       new RouteBuilder() {
         @Override
         public void configure() throws Exception {
           from(queueEndpointName).bean(Consumer.class, "consume");
         }
       });
   camelContext.start();
   final ProducerTemplate producerTemplate = camelContext.createProducerTemplate();
   producerTemplate.sendBody(queueEndpointName, "message");
 }
예제 #26
0
  @Override
  @Before
  protected void setUp() throws Exception {
    super.setUp();

    context2 = new DefaultCamelContext();
    template2 = context2.createProducerTemplate();

    ServiceHelper.startServices(template2, context2);

    // add routes after CamelContext has been started
    RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
    if (routeBuilder != null) {
      context2.addRoutes(routeBuilder);
    }
  }
예제 #27
0
  public static void main(String args[]) throws Exception {
    // START SNIPPET: e1
    CamelContext context = new DefaultCamelContext();
    // END SNIPPET: e1
    // Set up the ActiveMQ JMS Components
    // START SNIPPET: e2
    ConnectionFactory connectionFactory =
        new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
    // Note we can explicit name the component
    context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
    // END SNIPPET: e2
    // Add some configuration by hand ...
    // START SNIPPET: e3
    context.addRoutes(
        new RouteBuilder() {
          public void configure() {
            //    from("test-jms:queue:test.queue").to("file://tmp/camel");
            from("test-jms:queue:test.queue").to("file:/tmp/camel");
          }
        });
    // END SNIPPET: e3
    // Camel template - a handy class for kicking off exchanges
    // START SNIPPET: e4
    ProducerTemplate template = context.createProducerTemplate();
    // END SNIPPET: e4
    // Now everything is set up - lets start the context
    context.start();
    // Now send some test text to a component - for this case a JMS Queue
    // The text get converted to JMS messages - and sent to the Queue
    // test.queue
    // The file component is listening for messages from the Queue
    // test.queue, consumes
    // them and stores them to disk. The content of each file will be the
    // test we sent here.
    // The listener on the file component gets notified when new files are
    // found ... that's it!
    // START SNIPPET: e5
    for (int i = 0; i < 10; i++) {
      template.sendBody("test-jms:queue:test.queue", "Test Message: " + i);
    }
    // END SNIPPET: e5

    // wait a bit and then stop
    Thread.sleep(1000);
    context.stop();
  }
  public ForwardExpressTestApplication() throws Exception {
    final SimpleRegistry registry = new SimpleRegistry();

    this.context = new DefaultCamelContext(registry);
    context.setTracing(true);
    this.producerTemplate = new DefaultProducerTemplate(context);

    final ActiveMQComponent jmsComponent = new ActiveMQComponent();
    jmsComponent.setBrokerURL("tcp://localhost:61616");
    context.addComponent("jms", jmsComponent);

    context.addRoutes(new Routes());
    context.start();
    producerTemplate.start();

    this.ui = new UI();
  }
예제 #29
0
  public static void main(String[] a) throws Exception {
    CamelContext camelContext = new DefaultCamelContext();
    camelContext.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {

            from("file:src/data/inbox/dini?noop=true")
                .choice()
                .when(simple("${body} contains 'Dinesh'"))
                .to("file:src/data/outbox")
                .otherwise()
                .to("file:src/data/others");
          }
        });
    camelContext.start();
    Thread.sleep(10000);
    camelContext.stop();
  }
  private void addDTSMessageReceiverRoute(final CamelContext context) throws Exception {
    final DTSMessageReceiverRoute route = new DTSMessageReceiverRoute();

    route.setDTSMessageReceiverUri("direct:dtsMessageReceiver");
    route.setPayloadDestinationUri(getDistributionEnvelopeReceiverUri());

    // File housekeeping
    final DTSFileHousekeeper fileHousekeeper = new DTSFileHousekeeper();
    fileHousekeeper.setDestinationFolder(
        context.resolvePropertyPlaceholders("{{dts.completedFolder}}"));
    route.setFileHousekeeper(fileHousekeeper);

    final DTSFileHousekeeper errorFileHousekeeper = new DTSFileHousekeeper();
    errorFileHousekeeper.setDestinationFolder(
        context.resolvePropertyPlaceholders("{{dts.errorFolder}}"));
    route.setErrorFileHousekeeper(errorFileHousekeeper);

    context.addRoutes(route);
  }