Package org.apache.camel

Examples of org.apache.camel.ExchangeTimedOutException


                }
                if (message != null) {
                    exchange.setOut(new JmsMessage(message, endpoint.getBinding()));
                } else {
                    // lets set a timed out exception
                    exchange.setException(new ExchangeTimedOutException(exchange, requestTimeout));
                }
            } catch (Exception e) {
                exchange.setException(e);
            }
        } else {
View Full Code Here


        if (sync) {
            // wait for response, consider timeout
            LOG.debug("Waiting for response using timeout {} millis.", timeout);
            boolean done = latch.await(timeout, TimeUnit.MILLISECONDS);
            if (!done) {
                throw new ExchangeTimedOutException(exchange, timeout);
            }

            // did we get a response
            ResponseHandler handler = (ResponseHandler) session.getHandler();
            if (handler.getCause() != null) {
                throw new CamelExchangeException("Error occurred in ResponseHandler", exchange, handler.getCause());
            } else if (!handler.isMessageReceived()) {
                // no message received
                throw new ExchangeTimedOutException(exchange, timeout);
            } else {
                // set the result on either IN or OUT on the original exchange depending on its pattern
                if (ExchangeHelper.isOutCapable(exchange)) {
                    Mina2PayloadHelper.setOut(exchange, handler.getMessage());
                } else {
View Full Code Here

                    done = latch.await(timeout, TimeUnit.MILLISECONDS);
                } catch (InterruptedException e) {
                    // ignore
                }
                if (!done) {
                    exchange.setException(new ExchangeTimedOutException(exchange, timeout));
                    // count down to indicate timeout
                    latch.countDown();
                }
            } else {
                if (log.isTraceEnabled()) {
View Full Code Here

            if (exchangeState == HttpExchange.STATUS_COMPLETED) {
                // process the response as the state is ok
                getBinding().populateResponse(exchange, httpExchange);
            } else if (exchangeState == HttpExchange.STATUS_EXPIRED) {
                // we did timeout
                throw new ExchangeTimedOutException(exchange, client.getTimeout());
            } else {
                // some kind of other error
                if (exchange.getException() != null) {
                    throw exchange.getException();
                } else {
View Full Code Here

                } catch (Exception e) {
                    exchange.setException(e);
                }
            } else if (exchangeState == HttpExchange.STATUS_EXPIRED) {
                // we did timeout
                exchange.setException(new ExchangeTimedOutException(exchange, client.getTimeout()));
            } else {
                // some kind of other error
                if (exchange.getException() != null) {
                    exchange.setException(new CamelExchangeException("JettyClient failed with state " + exchangeState, exchange));
                }
View Full Code Here

            if (LOG.isDebugEnabled()) {
                LOG.debug("Waiting for response using timeout " + timeout + " millis.");
            }
            boolean done = latch.await(timeout, TimeUnit.MILLISECONDS);
            if (!done) {
                throw new ExchangeTimedOutException(exchange, timeout);
            }

            // did we get a response
            ResponseHandler handler = (ResponseHandler) session.getHandler();
            if (handler.getCause() != null) {
View Full Code Here

                    log.trace("Waiting for task to complete using timeout (ms): " + timeout + " at [" + endpoint.getEndpointUri() + "]");
                }
                // lets see if we can get the task done before the timeout
                boolean done = latch.await(timeout, TimeUnit.MILLISECONDS);
                if (!done) {
                    exchange.setException(new ExchangeTimedOutException(exchange, timeout));
                    // count down to indicate timeout
                    latch.countDown();
                }
            } else {
                if (log.isTraceEnabled()) {
View Full Code Here

        try {
            template.request(url, null);
            fail("Should have thrown a timeout exception");
        } catch (Exception e) {
            ExchangeTimedOutException cause = assertIsInstanceOf(ExchangeTimedOutException.class, e.getCause());
            assertEquals(2000, cause.getTimeout());
        }
    }
View Full Code Here

                    message.setJMSCorrelationID(correlationId);
                    exchange.getOut().setHeader("JMSCorrelationID", correlationId);
                }
            } else {
                // no response, so lets set a timed out exception
                exchange.setException(new ExchangeTimedOutException(exchange, requestTimeout));
            }
        } catch (Exception e) {
            exchange.setException(e);
        }
View Full Code Here

                } catch (Exception e) {
                    exchange.setException(e);
                }
            } else if (exchangeState == HttpExchange.STATUS_EXPIRED) {
                // we did timeout
                exchange.setException(new ExchangeTimedOutException(exchange, client.getTimeout()));
            } else {
                // some kind of other error
                if (exchange.getException() != null) {
                    exchange.setException(new CamelExchangeException("JettyClient failed with state " + exchangeState, exchange));
                }
View Full Code Here

TOP

Related Classes of org.apache.camel.ExchangeTimedOutException

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.