camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Bridgewater <max.bridgewa...@gmail.com>
Subject Puzzling Synchronization and OnComplete
Date Fri, 30 May 2014 19:49:18 GMT
Now, this one is really puzzling me. What is the difference between the
following two routes? I thought they would produce the same thing.

Right now, route1 produces "hoho" while the route2 produces "haha".


        <route id="route1">
            <from uri="restlet:/route1"/>
             <onCompletion onCompleteOnly="true">
                <transform>
                    <groovy>exchange.getIn().setBody("haha");
exchange.getOut().setBody("haha"); "haha"</groovy>
                   </transform>
            </onCompletion>
             <transform>
                   <constant>hoho</constant>
               </transform>
        </route>

        <route id="route2">
            <from uri="restlet:/route2"/>
             <transform>
                <groovy>
                    exchange.getUnitOfWork().addSynchronization(
                        new org.apache.camel.spi.Synchronization(){
                        public void
onComplete(org.apache.camel.Exchange x){
                                x.getOut().setBody("haha");
                        }
                        public void     onFailure(org.apache.camel.Exchange
exchange){}
                    }
                )
            </groovy>
            </transform>
             <transform>
                   <constant>hoho</constant>
               </transform>
        </route>





Max.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message