Package org.apache.camel

Examples of org.apache.camel.Processor


        return processor;
    }

    protected Processor createProcessor(RouteContext routeContext, ProcessorDefinition<?> output) throws Exception {
        Processor processor = null;
        // at first use custom factory
        if (routeContext.getCamelContext().getProcessorFactory() != null) {
            processor = routeContext.getCamelContext().getProcessorFactory().createProcessor(routeContext, output);
        }
        // fallback to default implementation if factory did not create the processor
View Full Code Here


    /**
     * Creates the processor and wraps it in any necessary interceptors and error handlers
     */
    protected Processor makeProcessor(RouteContext routeContext) throws Exception {
        Processor processor = null;

        // allow any custom logic before we create the processor
        preCreateProcessor();

        // resolve properties before we create the processor
View Full Code Here

            @Override
            public void configure() throws Exception {
                from(cpoFrom)
                        .unmarshal().bindy(BindyType.Csv, "models.csv")
                        .split(body())
                        .process(new Processor() {
                            @SuppressWarnings("unchecked")
                            @Override
                            public void process(Exchange exchange) throws Exception {
                                Object body = exchange.getIn().getBody();
View Full Code Here

                from("direct:start")
                    .doTry()
                        .to("validator:org/apache/camel/component/validator/text.xsd")
                        .to("mock:valid")
                    .doCatch(NumberFormatException.class)
                    .process(new Processor() {
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            System.err.println("helo " + exchange.getException());                       
                        }
                    })
View Full Code Here

    }

    public void commit() {
        // now lets turn all of the event driven consumer processors into a single route
        if (!eventDrivenProcessors.isEmpty()) {
            Processor target = Pipeline.newInstance(getCamelContext(), eventDrivenProcessors);

            String routeId = route.idOrCreate(getCamelContext().getNodeIdFactory());

            // and wrap it in a unit of work so the UoW is on the top, so the entire route will be in the same UoW
            CamelInternalProcessor internal = new CamelInternalProcessor(target);
View Full Code Here

    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        BeanEndpoint endpoint = new BeanEndpoint(uri, this);
        endpoint.setBeanName(remaining);
        Boolean cache = getAndRemoveParameter(parameters, "cache", Boolean.class, Boolean.FALSE);
        endpoint.setCache(cache);
        Processor processor = endpoint.getProcessor();
        setProperties(processor, parameters);
        return endpoint;
    }
View Full Code Here

        // and register the bean as a holder on the endpoint
        BeanHolder holder = new ConstantBeanHolder(bean, getCamelContext());
        endpoint.setBeanHolder(holder);

        // create processor
        Processor processor = endpoint.getProcessor();
        setProperties(processor, parameters);
        return endpoint;
    }
View Full Code Here

    @Override
    protected void doStart() throws Exception {
        LOG.debug("Consuming expected messages from: {}", expectedMessageEndpoint);

        final List<Object> expectedBodies = new ArrayList<Object>();
        EndpointHelper.pollEndpoint(expectedMessageEndpoint, new Processor() {
            public void process(Exchange exchange) throws Exception {
                Object body = getInBody(exchange);
                LOG.trace("Received message body {}", body);
                expectedBodies.add(body);
            }
View Full Code Here

    }

    private void failedMessagesOpenCircuitToPreventMessageThree(String endpoint) throws InterruptedException, Exception {
        expectsMessageCount(2, result);

        result.whenAnyExchangeReceived(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                exchange.setException(new MyCustomException());
            }
        });
View Full Code Here

        halfOpenCircuitClosesAfterTimeout(endpoint);
    }

    private void halfOpenCircuitClosesAfterTimeout(String endpoint) throws InterruptedException, Exception {
        expectsMessageCount(2, result);
        result.whenAnyExchangeReceived(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                exchange.setException(new MyCustomException());
            }
        });
View Full Code Here

TOP

Related Classes of org.apache.camel.Processor

Copyright © 2018 www.massapicom. 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.