Examples of DelegateProcessor


Examples of org.apache.camel.processor.DelegateProcessor

        answer.beanName = beanName;
        return answer;
    }

    public Processor createErrorHandler(RouteContext routeContext, Processor processor) throws Exception {
        return new DelegateProcessor(processor) {
            @Override
            public void process(Exchange exchange) throws Exception {
                exchange.setProperty(PROPERTY_NAME, beanName);
                super.process(exchange);
            }
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

                SpringTransactionPolicy notsupported = new SpringTransactionPolicy(lookup("PROPAGATION_NOT_SUPPORTED", TransactionTemplate.class));
                SpringTransactionPolicy requirenew = new SpringTransactionPolicy(lookup("PROPAGATION_REQUIRES_NEW", TransactionTemplate.class));

                Policy rollback = new Policy() {
                    public Processor wrap(RouteContext routeContext, Processor processor) {
                        return new DelegateProcessor(processor) {
                            @Override
                            public void process(Exchange exchange) throws Exception {
                                processNext(exchange);
                                throw new RuntimeException("rollback");
                            }

                            @Override
                            public String toString() {
                                return "rollback(" + getProcessor() + ")";
                            }
                        };
                    }
                };

                Policy catchRollback = new Policy() {
                    public Processor wrap(RouteContext routeContext, Processor processor) {
                        return new DelegateProcessor(processor) {
                            @Override
                            public void process(Exchange exchange) {
                                try {
                                    processNext(exchange);
                                } catch (Throwable ignore) {
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

            assertSendToProcessor(unwrapChannel(endpoints.get(1)).getNextProcessor(), "seda://b");
        }
    }

    protected List<Route> buildRouteWithInterceptor() throws Exception {
        interceptor1 = new DelegateProcessor() {
        };

        // START SNIPPET: e7
        interceptor2 = new MyInterceptorProcessor();
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

        }
    }

    protected Processor unwrapDelegateProcessor(Processor processor) {
        if (processor instanceof DelegateProcessor) {
            DelegateProcessor delegate = (DelegateProcessor) processor;
            return delegate.getProcessor();
        } else {
            return processor;
        }
    }
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

            // MUST DO THIS
            // force id creation as sub nodes have lazy assigned ids
            definition.idOrCreate(context.getNodeIdFactory());

            return new DelegateProcessor(target) {
                @Override
                protected void processNext(Exchange exchange) throws Exception {
                    LOG.debug("Debugging at: " + definition.toString() + " with id: " + definition.getId() + " with exchange: " + exchange);

                    // record the path taken at runtime
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

      // The target is required.
      if( target == null )
        throw new RuntimeCamelException("target provided.");
     
      // Interceptors are optional
      DelegateProcessor first=null;
      DelegateProcessor last=null;
        for (DelegateProcessor p : intercepts) {
            if( first == null ) {
              first = p;
            }
            if( last != null ) {
              last.setNext(p);
            }
            last = p;
        }
       
        Processor p = target.createProcessor();
        if( last != null ) {
          last.setNext(p);
        }
        return first == null ? p : first;
    }
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

            Policy notsupported = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_NOT_SUPPORTED"));
            Policy requirenew = new SpringTransactionPolicy(bean(TransactionTemplate.class, "PROPAGATION_REQUIRES_NEW"));

            Policy rollback = new Policy() {
          public Processor wrap(Processor processor) {
            return new DelegateProcessor(processor) {
                  @Override
                  public void process(Exchange exchange) throws Exception {
                    processNext(exchange);
                    throw new RuntimeException("rollback");
                  }
                 
                  @Override
                  public String toString() {
                        return "rollback(" + next + ")";
                  }
                };
          }
            };
           
            Policy catchRollback = new Policy() {
          public Processor wrap(Processor processor) {
            return new DelegateProcessor(processor) {
                  @Override
                  public void process(Exchange exchange) {
                    try {
                      processNext(exchange);
                    } catch ( Throwable e ) {
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

        if (transactionTemplate == null) {
            log.warn("No TransactionTemplate available so transactions will not be enabled!");
            return processor;
        }

        return new DelegateProcessor(processor) {

            public void process(final Exchange exchange) {
                transactionTemplate.execute(new TransactionCallbackWithoutResult() {
                    protected void doInTransactionWithoutResult(TransactionStatus status) {
                        try {
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

     * @return
     */
    @Fluent
    public FromBuilder trace(@FluentArg("category")String category) {
        final Log log = LogFactory.getLog(category);
        return intercept(new DelegateProcessor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                log.trace(exchange);
                processNext(exchange);
            }
View Full Code Here

Examples of org.apache.camel.processor.DelegateProcessor

            assertEndpointUri(endpoints.get(1), "queue:b");
        }
    }

    protected List<Route> buildRouteWithInterceptor() throws Exception {
        interceptor1 = new DelegateProcessor() {
        };

        // START SNIPPET: e7       
        interceptor2 = new MyInterceptorProcessor();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.