Package org.apache.camel

Examples of org.apache.camel.ExchangePattern


     * @param exchange the exchange to interrogate
     * @return true if the exchange is defined as an {@link ExchangePattern} which supports
     * OUT messages
     */
    public static boolean isOutCapable(Exchange exchange) {
        ExchangePattern pattern = exchange.getPattern();
        return pattern != null && pattern.isOutCapable();
    }
View Full Code Here


            // do nothing here
        }


        private void commitOutputMessage() {
            ExchangePattern pattern;
            if (isOneWay) {
                pattern = ExchangePattern.InOnly;
            } else {
                pattern = ExchangePattern.InOut;
            }
View Full Code Here

        }
        return camelTemplate;
    }

    public boolean send(Message<?> message) throws MessageRejectedException, MessageDeliveryException {
        ExchangePattern pattern;
        boolean result = false;
        if (isExpectReply()) {
            pattern = ExchangePattern.InOut;
        } else {
            pattern = ExchangePattern.InOnly;
View Full Code Here

        endpoint.assertIsSatisfied();

        List<Exchange> list = endpoint.getReceivedExchanges();
        for (Exchange exchange : list) {
            LOG.info("Received: " + exchange.getIn().getBody());
            ExchangePattern pattern = exchange.getPattern();
            assertEquals("Expected pattern on exchange: " + exchange, ExchangePattern.InOnly, pattern);
        }

    }
View Full Code Here

        assertMessageReceivedWithPattern("direct:testSetExchangePatternInOnly", ExchangePattern.InOnly);
    }


    protected void assertMessageReceivedWithPattern(String sendUri, ExchangePattern expectedPattern) throws InterruptedException {
        ExchangePattern sendPattern;
        switch (expectedPattern) {
        case InOut:
            sendPattern = ExchangePattern.InOnly;
            break;
        case InOnly:
        case RobustInOnly:
            sendPattern = ExchangePattern.InOut;
            break;
        default:
            sendPattern = ExchangePattern.InOnly;
        }

        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
        String expectedBody = "InOnlyMessage";
        resultEndpoint.expectedBodiesReceived(expectedBody);
        template.sendBody(sendUri, sendPattern, expectedBody);
        resultEndpoint.assertIsSatisfied();
        ExchangePattern actualPattern = resultEndpoint.getExchanges().get(0).getPattern();
        assertEquals("received exchange pattern", actualPattern, expectedPattern);
    }
View Full Code Here

        endpoint.assertIsSatisfied();

        List<Exchange> list = endpoint.getReceivedExchanges();
        for (Exchange exchange : list) {
            LOG.info("Received: " + exchange.getIn().getBody());
            ExchangePattern pattern = exchange.getPattern();
            assertEquals("Expected pattern on exchange: " + exchange, ExchangePattern.InOnly, pattern);
        }

    }
View Full Code Here

     * @param exchange the exchange to interrogate
     * @return true if the exchange is defined as an {@link ExchangePattern} which supports
     * IN messages
     */
    public static boolean isInCapable(Exchange exchange) {
        ExchangePattern pattern = exchange.getPattern();
        return pattern != null && pattern.isInCapable();
    }
View Full Code Here

     * @param exchange the exchange to interrogate
     * @return true if the exchange is defined as an {@link ExchangePattern} which supports
     * OUT messages
     */
    public static boolean isOutCapable(Exchange exchange) {
        ExchangePattern pattern = exchange.getPattern();
        return pattern != null && pattern.isOutCapable();
    }
View Full Code Here

        this.methodInfoCache = methodInfoCache;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        BeanInvocation invocation = new BeanInvocation(method, args);
        ExchangePattern pattern = ExchangePattern.InOut;
        MethodInfo methodInfo = methodInfoCache.getMethodInfo(method);
        if (methodInfo != null) {
            pattern = methodInfo.getPattern();
        }
        BeanExchange exchange = new BeanExchange(endpoint.getCamelContext(), pattern);
        exchange.setInvocation(invocation);

        producer.process(exchange);
        Throwable fault = exchange.getException();
        if (fault != null) {
            throw new InvocationTargetException(fault);
        }
        if (pattern.isOutCapable()) {
            return exchange.getOut(true).getBody();
        } else {
            return null;
        }
    }
View Full Code Here

        }
        return camelTemplate;
    }

    public boolean send(Message<?> message) throws MessageRejectedException, MessageDeliveryException {
        ExchangePattern pattern;
        boolean result = false;
        if (isExpectReply()) {
            pattern = ExchangePattern.InOut;
        } else {
            pattern = ExchangePattern.InOnly;
View Full Code Here

TOP

Related Classes of org.apache.camel.ExchangePattern

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.