Search code examples
javajbossapache-camelblueprint

JBoss Fuse - get body type


I'm new to JBoss Fuse platform and I'm trying to run a simple Apache Camel XML route to send email messages. Incoming messages may be of specified type T, but also there can be an XML, which I then need to unmarshal using JAXb to get an object of type T. So I need a filter to check if incoming message type is not T then unmarshal it. How can I accomplish that? I need something like:

<filter>
  <simple>${body.type} != 'T'</simple>
  <unmarshal ref="jaxB" />
</filter>

Solution

  • How about this?

    <filter>
      <simple>${body} not is 'your.class.Type'</simple>
      <unmarshal ref="jaxB" />
      <to ... />
    </filter>
    

    or

    <filter>
      <simple>${body} is 'java.lang.String'</simple>
      <unmarshal ref="jaxB" />
      <to ... />
    </filter>