Package org.apache.camel

Examples of org.apache.camel.ExchangeTimedOutException


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

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


        registry.bind("B", new Processor() {
            public void process(Exchange exchange) throws Exception {
                log.info("B headers " + exchange.getIn().getHeaders());

                if ("ExchangeTimedOutException".equals(exchange.getIn().getBody(String.class))) {
                    throw new ExchangeTimedOutException(exchange, 1);
                } else if ("Exception".equals(exchange.getIn().getBody(String.class))) {
                    throw new Exception();
                }
            }
        });
View Full Code Here

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

            // did we get a response
            ResponseHandler handler = (ResponseHandler) session.getHandler();
            if (handler.getCause() != null) {
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

                    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 {
                log.trace("Waiting for task to complete (blocking) at [{}]", endpoint.getEndpointUri());
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

        return new Callable<Message>() {
            @Override
            public Message call() throws Exception {
                if (!correlationRule.getLatch().await(timeout, TimeUnit.MILLISECONDS)) {
                    throw new ExchangeTimedOutException(correlationRule.getExchange(), timeout);
                }
                return correlationRule.getReplyMessage();
            }
        };
    }
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) {
View Full Code Here

                exchange.getIn().setBody(is);
            }
        });
        Exception e = reply.getException();
        assertNotNull("Should have thrown an exception", e);
        ExchangeTimedOutException cause = assertIsInstanceOf(ExchangeTimedOutException.class, e);
        assertEquals(2000, cause.getTimeout());
        assertTrue("The input stream should be closed", is.isClosed());
    }
View Full Code Here

                Message message = holder.getMessage();

                boolean timeout = holder.isTimeout();
                if (timeout) {
                    // no response, so lets set a timed out exception
                    exchange.setException(new ExchangeTimedOutException(exchange, holder.getRequestTimeout()));
                } else {
                    JmsMessage response = new JmsMessage(message, endpoint.getBinding());
                    Object body = response.getBody();

                    if (endpoint.isTransferException() && body instanceof Exception) {
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.