Package org.apache.camel

Examples of org.apache.camel.RollbackExchangeException


            return;
        }

        // throw exception to rollback
        if (message != null) {
            throw new RollbackExchangeException(message, exchange);
        } else {
            throw new RollbackExchangeException(exchange);
        }
    }
View Full Code Here


                        // do not send a reply but wrap and rethrow the exception
                        rce = wrapRuntimeCamelException(exchange.getException());
                    }
                } else if (exchange.isRollbackOnly()) {
                    // rollback only so wrap an exception so we can rethrow the exception to cause rollback
                    rce = wrapRuntimeCamelException(new RollbackExchangeException(exchange));
                } else if (exchange.getOut().getBody() != null) {
                    // a fault occurred while processing
                    body = (JmsMessage) exchange.getOut();
                    sendReply = true;
                }
View Full Code Here

            // do not do anything more as we should only mark the rollback
            return;
        }

        if (message != null) {
            exchange.setException(new RollbackExchangeException(message, exchange));
        } else {
            exchange.setException(new RollbackExchangeException(exchange));
        }
    }
View Full Code Here

                        // do not send a reply but wrap and rethrow the exception
                        rce = wrapRuntimeCamelException(exchange.getException());
                    }
                } else if (exchange.isRollbackOnly()) {
                    // rollback only so wrap an exception so we can rethrow the exception to cause rollback
                    rce = wrapRuntimeCamelException(new RollbackExchangeException(exchange));
                } else if (exchange.getOut().getBody() != null) {
                    // a fault occurred while processing
                    body = (JmsMessage) exchange.getOut();
                    sendReply = true;
                }
View Full Code Here

            // do not do anything more as we should only mark the rollback
            return;
        }

        if (message != null) {
            exchange.setException(new RollbackExchangeException(message, exchange));
        } else {
            exchange.setException(new RollbackExchangeException(exchange));
        }
    }
View Full Code Here

            template.sendBody("direct:start", "A,B,Kaboom,C");
            fail("Should thrown an exception");
        } catch (CamelExecutionException e) {
            CamelExchangeException ee = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
            assertTrue(ee.getMessage().startsWith("Sequential processing failed for number 2. Exchange[Message: Kaboom]"));
            RollbackExchangeException re = assertIsInstanceOf(RollbackExchangeException.class, ee.getCause());
            assertEquals("Intended rollback. Exchange[Message: Kaboom]", re.getMessage());
        }

        assertMockEndpointsSatisfied();
    }
View Full Code Here

            template.sendBody("direct:start", "A,Forced,B,Kaboom,C");
            fail("Should thrown an exception");
        } catch (CamelExecutionException e) {
            CamelExchangeException ee = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
            assertTrue(ee.getMessage().startsWith("Sequential processing failed for number 3. Exchange[Message: Kaboom]"));
            RollbackExchangeException re = assertIsInstanceOf(RollbackExchangeException.class, ee.getCause());
            assertEquals("Intended rollback. Exchange[Message: Kaboom]", re.getMessage());
        }

        assertMockEndpointsSatisfied();
    }
View Full Code Here

            Exception cause = null;

            if (exchange.isFailed() || exchange.isRollbackOnly()) {
                if (exchange.isRollbackOnly()) {
                    // rollback only so wrap an exception so we can rethrow the exception to cause rollback
                    rce = wrapRuntimeCamelException(new RollbackExchangeException(exchange));
                } else if (exchange.getException() != null) {
                    // an exception occurred while processing
                    if (endpoint.isTransferException()) {
                        // send the exception as reply, so null body and set the exception as the cause
                        body = null;
View Full Code Here

            template.sendBody("direct:start", "A,B,Kaboom,C");
            fail("Should thrown an exception");
        } catch (CamelExecutionException e) {
            CamelExchangeException ee = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
            assertEquals("Sequential processing failed for number 2 on the exchange: Exchange[Message: Kaboom]", ee.getMessage());
            RollbackExchangeException re = assertIsInstanceOf(RollbackExchangeException.class, ee.getCause());
            assertEquals("Intended rollback on the exchange: Exchange[Message: Kaboom]", re.getMessage());
        }

        assertMockEndpointsSatisfied();
    }
View Full Code Here

            template.sendBody("direct:start", "A,Forced,B,Kaboom,C");
            fail("Should thrown an exception");
        } catch (CamelExecutionException e) {
            CamelExchangeException ee = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
            assertEquals("Sequential processing failed for number 3 on the exchange: Exchange[Message: Kaboom]", ee.getMessage());
            RollbackExchangeException re = assertIsInstanceOf(RollbackExchangeException.class, ee.getCause());
            assertEquals("Intended rollback on the exchange: Exchange[Message: Kaboom]", re.getMessage());
        }

        assertMockEndpointsSatisfied();
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.RollbackExchangeException

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.