taran,

Without seeing your actual RouteBuilder class of Camel XML file, it's hard to know what exactly you are trying to do. In general... You can send POJOs as message body in Camel, but ServiceMix uses normalized (read: XML only) message routing. If you aren't using any of the JBI endpoints, sending POJO may work fine but if you also want to use JBI components (e.g. JMS consumer endpoint defined in xbean.xml) you will have to marshal/unmarshal data to/from XML. Fortunately, Camel also has some good support for doing that -- have a look at http://activemq.apache.org/camel/data-format.html.

Regards,

Gert


taran wrote:
Hi

I'm new to servicemix and need some help.
Currently i'm trying to implement splitter and aggregator using camel
components.

Suppose i have a POJO, Organization which contains a list of Employee POJOs.
Can i pass instance of POJO Organization in the message exchange from
endpoint A, and get unmarshalled POJO Organization directly from message
body from exchange at endpoint B.

Essentially, i want to avoid processing xml at each endpoint using XPATH.

I looked at post
http://www.nabble.com/Better-Aggregator-support-p12564277s22882.html
which shows below mentioned code

private Expression getSplitterExpression () {
                Expression splitterExpression = new Expression(){
            public Object evaluate(Exchange exchange) {
                BBScoringRequest bbScoringRequest = (BBScoringRequest)
exchange.getIn().getBody();
                JmsExchange jmsExchange = (JmsExchange) exchange;
                javax.jms.Message jmsMessage =
jmsExchange.getIn().getJmsMessage();
                try {
                    String jmsMessageID = jmsMessage.getJMSMessageID();
                    jmsMessage.setJMSCorrelationID(jmsMessageID);
                } catch (JMSException e) {
                    throw new RuntimeException(e);
                }
                return bbScoringRequest.getRequest().getParties();
            }
        };
        return splitterExpression;
        }
        
        private Expression getAggregatorExpression () {
Expression aggregatorExpression = new Expression(){ public Object evaluate(Exchange exchange) {
                                PartyType party = (PartyType) 
exchange.getIn().getBody();
                                JmsMessage in = (JmsMessage) exchange.getIn();
                                String jmsCorrelationID = null;
                            try {
                    jmsCorrelationID =
in.getJmsMessage().getJMSCorrelationID();
                } catch (JMSException e) {
                    throw new RuntimeException(e);
                }
                return jmsCorrelationID + party.getID();
            }
}; return aggregatorExpression;
        }


when i tried using it, i dont get POJOs from message exchange rather get
DomSource object.

Request any help on this.

best regards
taran

Reply via email to