Package org.apache.camel

Examples of org.apache.camel.Processor


        sendMessage(endpoint, "message four");
        assertMockEndpointsSatisfied();
    }

    protected Exchange sendMessage(final String endpoint, final Object body) throws Exception {
        return template.send(endpoint, new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody(body);
            }
        });
View Full Code Here


        assertMockEndpointsSatisfied();
    }

    protected void sendMessage(final Object messageId, final Object body) {
        template.send(startEndpoint, new Processor() {
            public void process(Exchange exchange) {
                // now lets fire in a message
                Message in = exchange.getIn();
                in.setBody(body);
                in.setHeader("messageId", messageId);
View Full Code Here

                    .doCatch(Exception.class)
                        .to("mock:catch")
                    .end();

                from("direct:bar")
                    .process(new Processor() {
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            String body = exchange.getIn().getBody(String.class);
                            if (body.contains("Kaboom")) {
                                throw new IllegalArgumentException("Forced error");
View Full Code Here

             */
            failures.set(0);
            callback.done(true);
            return true;
        }
        Processor processor = getProcessors().get(0);
        if (processor == null) {
            throw new IllegalStateException("No processors could be chosen to process CircuitBreaker");
        }

        AsyncProcessor albp = AsyncProcessorConverterHelper.convert(processor);
View Full Code Here

                rest("/metadata/profile")
                    .get("/{id}").to("direct:profileLookup")
                    .post("/tag").to("direct:tag");

                from("direct:profileLookup").transform().constant("Mock profile");
                from("direct:tag").log("${headers}").process(new Processor() {
                    @Override
                    public void process(Exchange ex) throws Exception {
                        ex.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 303);
                        ex.getOut().setHeader("Location", "/metadata/profile/1");
                    }
View Full Code Here

        GenericFileConsumer<?> consumer = null;
        try {
            // create a new consumer which can poll the exchanges we want to browse
            // do not provide a processor as we do some custom processing
            consumer = createConsumer(null);
            consumer.setCustomProcessor(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    answer.add(exchange);
                }
            });
View Full Code Here

        return new BindingProducer(this);
    }

    @Override
    public Consumer createConsumer(Processor processor) throws Exception {
        Processor bindingProcessor = new BindingConsumerProcessor(this, processor);
        return delegate.createConsumer(bindingProcessor);
    }
View Full Code Here

                List<?> children = nav.next();
                for (Object child : children) {
                    if (child instanceof Channel) {
                        if (includeErrorHandler) {
                            // special for error handler as they are tied to the Channel
                            Processor errorHandler = ((Channel) child).getErrorHandler();
                            if (errorHandler != null && errorHandler instanceof Service) {
                                services.add((Service) errorHandler);
                            }
                        }
                        Processor next = ((Channel) child).getNextProcessor();
                        if (next != null && next instanceof Service) {
                            services.add((Service) next);
                        }
                    }
                    if (child instanceof Service) {
View Full Code Here

            boolean exhausted = isExhausted(exchange, data);
            boolean redeliverAllowed = isRedeliveryAllowed(data);

            // if we are exhausted or redelivery is not allowed, then deliver to failure processor (eg such as DLC)
            if (!redeliverAllowed || exhausted) {
                Processor target = null;
                boolean deliver = true;

                // the unit of work may have an optional callback associated we need to leverage
                SubUnitOfWorkCallback uowCallback = exchange.getUnitOfWork().getSubUnitOfWorkCallback();
                if (uowCallback != null) {
View Full Code Here

        }

        // compute if we are exhausted or not
        boolean exhausted = isExhausted(exchange, data);
        if (exhausted) {
            Processor target = null;
            boolean deliver = true;

            // the unit of work may have an optional callback associated we need to leverage
            UnitOfWork uow = exchange.getUnitOfWork();
            if (uow != null) {
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.