Language and Page Formatting Options
A.2. Common Elements
When configuring ServiceMix EIP patterns in a ServiceMix configuration file, there are some common elements that occur in many of the pattern schemas. This section provides a brief overview of these common elements and explains how they can be mapped to equivalent constructs in Apache Camel.
All of the patterns supported by ServiceMix EIP use the
eip:exchange-targetelement to specify JBI target endpoints. Table A.1, “Mapping the Exchange Target Element” shows examples of how to map sample
eip:exchange-targetelements to Apache Camel endpoint URIs, where it is assumed that the
testprefix maps to the
Table A.1. Mapping the Exchange Target Element
|ServiceMix EIP Target||Apache Camel Endpoint URI|
| || |
| || |
| || |
| || |
The ServiceMix EIP component allows you to define predicate expressions in the XPath language. For example, XPath predicates can appear in
eip:xpath-predicateelements or in
eip:xpath-splitterelements, where the XPath predicate is specified using an
ServiceMix XPath predicates can easily be migrated to equivalent constructs in Apache Camel: that is, either the
xpathelement (in XML configuration) or the
xpath()command (in Java DSL). For example, the message filter pattern in Apache Camel can incorporate an XPath predicate as follows:
<route> <from uri="jbi:endpoint:http://progress.com/demos/test/messageFilter/endpoint"> <filter> <xpath>count(/test:world) = 1</xpath> <to uri="jbi:service:http://progress.com/demos/test/trace3"/> </filter> </route>
xpathelement specifies that only messages containing the
test:worldelement will pass through the filter.
Apache Camel also supports a wide range of other scripting languages including XQuery, PHP, Python, and Ruby, which can be used to define predicates. For details of all the supported predicate languages, see Expression and Predicate Languages.
When using XPath predicates in the ServiceMix EIP configuration, it is necessary to define a namespace context using the
eip:namespace-contextelement. The namespace is then referenced using a
When ServiceMix EIP configuration is migrated to Apache Camel, there is no need to define namespace contexts, because Apache Camel allows you to define XPath predicates without referencing a namespace context. You can simply drop the
eip:namespace-contextelements when you migrate to Apache Camel.