You can do something like this:

Message message = exchange.getIn();
String request = message.getBody(String.class);
if (request == null) {
  Source source = message.getBody(Source.class);
  if (source != null) {
    request = getRequestFromSource(source);
  }
}

If we had a converter to covert from CXF payload to string, we wouldn't the logic in "if (request == null)".



On 05/12/2010 11:24 AM, fjaouen wrote:
With 1.5.0 I was checking the instance of Exchange in a process method to
know if I have a CxfMessage or a JMSMessage in order to do different
treatment.

         if (aExchange instanceof JmsExchange) {
             JmsMessage jmsMessage = (JmsMessage) aExchange.getIn();
             String request = jmsMessage.getBody(String.class);
...
         }
         else if (aExchange instanceof CxfExchange) {
             CxfMessage cxfMessage = (CxfMessage) aExchange.getIn();
             Source source = cxfMessage.getBody(Source.class);
             String request = getRequestFromSource(source);
...
         }

So now how can I do this check ? On which object may I determine that I
receive a CXF or a JMS ?

Thank you !



hzbarcea wrote:
All DefaultExchange specializations were removed in 2.0.0.  What
seemed a good idea initially proved to be unnecessary.  This has been
communicated in the 2.0.0 Release Note [1]: "Exchange api cleanup.
Complete removal of specialized Exchange using generics."

The specialized Messages were preserved as they may deal with
specialized types of body (payloads).  You need use the
DefaultExchange instead of CxfExchange.  If you have any issues don't
hesitate to ask.

Cheers,
Hadrian

[1] http://camel.apache.org/camel-200-release.html


On Nov 13, 2009, at 1:31 PM, fjaouen wrote:

Hi there,

I am currently using Camel 1.5.0 and I am trying to make a migration
to
2.0.0 version.

It seems that org.apache.camel.component.cxf.CxfExchange class is not
anymore available in this new version ?

What is its remplacement ?

Is there an easy way to know what has been removed in this new
version or a
documentation explaining how to migrate these changes ?

Thank you !
--
View this message in context:
http://old.nabble.com/CxfExchange-is-not-anymore-available-in-Camel-2.0.0-tp26341178p26341178.html
Sent from the Camel Development mailing list archive at Nabble.com.



Reply via email to