By following the Composed Message Processor example (see
http://camel.apache.org/composed-message-processor.html) , 
I created my route as below:
<route>
<from uri="direct:split2"/>

<bean ref="baselineMappingService" method="genreateOrderItems"/>
        <split>
        <simple>body</simple>
        <choice>
        <when>
                <method bean="orderItemHelper" method="isWidget"/>
                <log message="body isWidget " loggingLevel="INFO"/>
        </when>
        <otherwise>
                <bean ref="myTransform" method="transform"/>
        </otherwise>
        </choice>
        </split>
</route>

The beans are listed as following:

public class BaselineMappingService {
        public List<OrderItem> genreateIteratorOrderItems(@Body String body){
                List<OrderItem> list =  new ArrayList<OrderItem>();
                if(body.contains("A")){
                        OrderItem item = new OrderItem();
                        item.type="widget";
                        list.add(item);
                        
                        OrderItem item2 = new OrderItem();
                        item2.type="non-widget";
                        list.add(item2);
                }
                return list;
        }

public class OrderItemHelper{
        private OrderItemHelper() { }
        public boolean isWidget(@Body OrderItem orderItem) {

        System.out.println("isWidget ?" + orderItem.type.equals("widget"));

        return orderItem.type.equals("widget");
        }
}

In runtime, the org.apache.camel.component.bean.MethodNotFoundException:
Method with name: isWidget not found on bean: demo.esb.OrderItem@437bedc6
was thrown.

Do I miss something ?

-Jing

--
View this message in context: 
http://camel.465427.n5.nabble.com/Composed-Message-Processor-example-Spring-XML-doesn-t-work-tp5551373p5551373.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to