Package org.apache.camel.impl

Examples of org.apache.camel.impl.GroupedExchange


                queueLock.unlock();
            }
        }

        private void sendExchanges() throws Exception {
            GroupedExchange grouped = null;

            Iterator<Exchange> iter = collection.iterator();
            while (iter.hasNext()) {
                Exchange exchange = iter.next();
                iter.remove();
                if (!groupExchanges) {
                    // non grouped so process the exchange one at a time
                    processExchange(exchange);
                } else {
                    // grouped so add all exchanges into one group
                    if (grouped == null) {
                        grouped = new GroupedExchange(exchange.getContext());
                    }
                    grouped.addExchange(exchange);
                }
            }

            // and after adding process the single grouped exchange
            if (grouped != null) {
View Full Code Here


* @version $Revision: 772172 $
*/
public class GroupedExchangeAggregationStrategy implements AggregationStrategy {

    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        GroupedExchange answer;
        if (!(oldExchange instanceof GroupedExchange)) {
            answer = new GroupedExchange(oldExchange);
            answer.addExchange(oldExchange);
        } else {
            answer = (GroupedExchange) oldExchange;
        }

        answer.addExchange(newExchange);
        return answer;
    }
View Full Code Here

            queue.add(exchange);
            interrupt();
        }
       
        private void sendExchanges() throws Exception {
            GroupedExchange grouped = null;

            Iterator<Exchange> iter = collection.iterator();
            while (iter.hasNext()) {
                Exchange exchange = iter.next();
                iter.remove();
                if (!groupExchanges) {
                    // non grouped so process the exchange one at a time
                    processExchange(exchange);
                } else {
                    // grouped so add all exchanges into one group
                    if (grouped == null) {
                        grouped = new GroupedExchange(exchange.getContext());
                    }
                    grouped.addExchange(exchange);
                }
            }

            // and after adding process the single grouped exchange
            if (grouped != null) {
View Full Code Here

        assertMockEndpointsSatisfied();

        Exchange out = result.getExchanges().get(0);
        assertTrue(out instanceof GroupedExchange);
        GroupedExchange grouped = (GroupedExchange)out;
        assertEquals(5, grouped.size());

        assertEquals("100", grouped.get(0).getIn().getBody(String.class));
        assertEquals("150", grouped.get(1).getIn().getBody(String.class));
        assertEquals("130", grouped.get(2).getIn().getBody(String.class));
        assertEquals("200", grouped.get(3).getIn().getBody(String.class));
        assertEquals("190", grouped.get(4).getIn().getBody(String.class));
        // END SNIPPET: e2
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.impl.GroupedExchange

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.