Package org.apache.camel

Examples of org.apache.camel.CamelExchangeException


            // we have a bad correlation key
            if (isIgnoreInvalidCorrelationKeys()) {
                LOG.debug("Invalid correlation key. This Exchange will be ignored: {}", exchange);
                return;
            } else {
                throw new CamelExchangeException("Invalid correlation key", exchange);
            }
        }

        // is the correlation key closed?
        if (closedCorrelationKeys != null && closedCorrelationKeys.containsKey(key)) {
View Full Code Here


        ExchangeHelper.prepareAggregation(oldExchange, newExchange);
        // must catch any exception from aggregation
        try {
            answer = onAggregation(oldExchange, exchange);
        } catch (Throwable e) {
            throw new CamelExchangeException("Error occurred during aggregation", exchange, e);
        }
        if (answer == null) {
            throw new CamelExchangeException("AggregationStrategy " + aggregationStrategy + " returned null which is not allowed", exchange);
        }

        // update the aggregated size
        answer.setProperty(Exchange.AGGREGATED_SIZE, size);
View Full Code Here

                if (getEndpoint().isContentCache()) {
                    getEndpoint().setExpression(exp);
                }
            } else {
                // no script to execute
                throw new CamelExchangeException("No script to evaluate", exchange);
            }
        }

        ObjectHelper.notNull(exp, "expression");
View Full Code Here

        try {
            String url = AhcHelper.createURL(exchange, endpoint);
            log.trace("Setting url {}", url);
            builder.setUrl(url);
        } catch (Exception e) {
            throw new CamelExchangeException("Error creating URL", exchange, e);
        }
        String method = extractMethod(exchange);
        log.trace("Setting method {}", method);
        builder.setMethod(method);
View Full Code Here

                        InputStream is = in.getMandatoryBody(InputStream.class);
                        body = new InputStreamBodyGenerator(is);
                    }
                }
            } catch (UnsupportedEncodingException e) {
                throw new CamelExchangeException("Error creating BodyGenerator from message body", exchange, e);
            } catch (IOException e) {
                throw new CamelExchangeException("Error serializing message body", exchange, e);
            }
        }

        if (body != null) {
            log.trace("Setting body {}", body);
View Full Code Here

    }

    public void process(Exchange exchange) throws Exception {
        if (endpoint.getConsumer() == null) {
            LOG.warn("No consumers available on endpoint: " + endpoint + " to process: " + exchange);
            throw new CamelExchangeException("No consumers available on endpoint: " + endpoint, exchange);
        } else {
            endpoint.getConsumer().getProcessor().process(exchange);
        }
    }
View Full Code Here

    public boolean process(Exchange exchange, AsyncCallback callback) {
        if (endpoint.getConsumer() == null) {
            LOG.warn("No consumers available on endpoint: " + endpoint + " to process: " + exchange);
            // indicate its done synchronously
            exchange.setException(new CamelExchangeException("No consumers available on endpoint: " + endpoint, exchange));
            callback.done(true);
            return true;
        } else {
            AsyncProcessor processor = AsyncProcessorConverterHelper.convert(endpoint.getConsumer().getProcessor());
            return AsyncProcessorHelper.process(processor, exchange, callback);
View Full Code Here

                        if (bytes != null) {
                            body = new ByteSequence(bytes);
                        }
                    }
                    if (body == null) {
                        throw new CamelExchangeException("In body message could not be converted to a ByteSequence or a byte array.", exchange);
                    }
                    dataManager.write(body, syncProduce);

                } finally {
                    decrementReference();
View Full Code Here

    protected URI selectDispatchUri(RouteboxEndpoint endpoint, Exchange exchange) throws Exception {
        URI dispatchUri;
       
        List<URI> consumerUris = getInnerContextConsumerList(endpoint.getConfig().getInnerContext());
        if (consumerUris.isEmpty()) {
            throw new CamelExchangeException("No routes found to dispatch in Routebox at " + endpoint, exchange);
        } else if (consumerUris.size() == 1) {
            dispatchUri = consumerUris.get(0);
        } else {
            if (!endpoint.getConfig().getDispatchMap().isEmpty()) {
                // apply URI string found in dispatch Map
                String key = exchange.getIn().getHeader("ROUTE_DISPATCH_KEY", String.class);
                if (endpoint.getConfig().getDispatchMap().containsKey(key)) {
                    dispatchUri = new URI(endpoint.getConfig().getDispatchMap().get(key));
                } else {
                    throw new CamelExchangeException("No matching entry found in Dispatch Map for ROUTE_DISPATCH_KEY: " + key, exchange);
                }
            } else {
                // apply dispatch strategy
                dispatchUri = endpoint.getConfig().getDispatchStrategy().selectDestinationUri(consumerUris, exchange);
                if (dispatchUri == null) {
                    throw new CamelExchangeException("No matching inner routes found for Operation", exchange);
                }
            }
        }
       
        if (LOG.isDebugEnabled()) {
View Full Code Here

                admin.sendEvent(event);
            } else {
                admin.postEvent(event);
            }
        } else {
            throw new CamelExchangeException("EventAdmin service not present", exchange);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.CamelExchangeException

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.