You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2017/08/25 08:22:03 UTC

svn commit: r1017260 [21/40] - in /websites/production/camel/content: ./ cache/

Modified: websites/production/camel/content/hl7.html
==============================================================================
--- websites/production/camel/content/hl7.html (original)
+++ websites/production/camel/content/hl7.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: HL7
@@ -86,90 +75,42 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="HL7-HL7Component">HL7 Component</h2><p>The <strong>HL7</strong> component is used for working with the HL7 MLLP protocol and <a shape="rect" class="external-link" href="http://www.hl7.org/implement/standards/product_brief.cfm?product_id=185" rel="nofollow">HL7 v2 messages</a> using the <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net" rel="nofollow">HAPI library</a>.</p><p>This component supports the following:</p><ul class="alternate"><li>HL7 MLLP codec for <a shape="rect" href="mina2.html">Mina</a></li><li>HL7 MLLP codec for&#160;<a shape="rect" href="netty4.html">Netty4</a> from&#160;<strong>Camel 2.15</strong> onwards</li><li><a shape="rect" href="type-converter.html">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat using the HAPI library</li><li class="confluence-link">Even more ease-of-use as it's integrated well with the <a shape="rect" href="mina2.html">camel-mina2</a> component.</li></ul
 ><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+<div class="wiki-content maincontent"><h2 id="HL7-HL7Component">HL7 Component</h2><p>The <strong>HL7</strong> component is used for working with the HL7 MLLP protocol and <a shape="rect" class="external-link" href="http://www.hl7.org/implement/standards/product_brief.cfm?product_id=185" rel="nofollow">HL7 v2 messages</a> using the <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net" rel="nofollow">HAPI library</a>.</p><p>This component supports the following:</p><ul class="alternate"><li>HL7 MLLP codec for <a shape="rect" href="mina2.html">Mina</a></li><li>HL7 MLLP codec for&#160;<a shape="rect" href="netty4.html">Netty4</a> from&#160;<strong>Camel 2.15</strong> onwards</li><li><a shape="rect" href="type-converter.html">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat using the HAPI library</li><li class="confluence-link">Even more ease-of-use as it's integrated well with the <a shape="rect" href="mina2.html">camel-mina2</a> component.</li></ul
 ><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-hl7&lt;/artifactId&gt;
     &lt;version&gt;x.x.x&lt;/version&gt;
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div><h3 id="HL7-HL7MLLPprotocol">HL7 MLLP protocol</h3><p>HL7 is often used with the HL7 MLLP protocol, which is a text based TCP socket based protocol. This component ships with a Mina and Netty4 Codec that conforms to the MLLP protocol so you can easily expose an HL7 listener accepting HL7 requests over the TCP transport layer. To expose a HL7 listener service, the <a shape="rect" href="mina2.html">camel-mina2</a>&#160;or <a shape="rect" href="netty4.html">camel-netty4</a> component is used with the <code>HL7MLLPCodec</code>&#160;(mina2) or <code>HL7MLLPNettyDecoder/HL7MLLPNettyEncoder</code> (Netty4).</p><p>HL7 MLLP codec can be configured as follows:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
  colspan="1" rowspan="1" class="confluenceTd"><p><code>startByte</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0x0b</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The start byte spanning the HL7 payload.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>endByte1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0x1c</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The first end byte spanning the HL7 payload.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>endByte2</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0x0d</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The 2nd end byte spanning the HL7 payload.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>charset</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>JVM Default</p></td><td colspan="1" rowspan="1" cl
 ass="confluenceTd"><p>The encoding (a <a shape="rect" class="external-link" href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html" rel="nofollow">charset name</a>) to use for the codec. If not provided, Camel will use the <a shape="rect" class="external-link" href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html#defaultCharset()" rel="nofollow">JVM default Charset</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>produceString</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>true</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>(as of Camel 2.14.1)</strong> If true, the codec creates a string using the defined charset. If false, the codec sends a plain byte array into the route, so that the HL7 Data Format can determine the actual charset from the HL7 message content.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>convertLFtoCR</code></p></td><t
 d colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd">Will convert <code>\n</code> to <code>\r</code> (<code>0x0d</code>, 13 decimal) as HL7 stipulates <code>\r</code> as segment terminators. The HAPI library requires the use of <code>\r</code>.</td></tr></tbody></table></div></div>
-
-
-<h4 id="HL7-ExposinganHL7listenerusingMina">Exposing an HL7 listener using Mina</h4><p>In the Spring XML file, we configure a mina2 endpoint to listen for HL7 requests using TCP on port <code>8888</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    &lt;endpoint id=&quot;hl7MinaListener&quot; uri=&quot;mina2:tcp://localhost:8888?sync=true&amp;amp;codec=#hl7codec&quot;/&gt;
-]]></script>
-</div></div><p><strong>sync=true</strong> indicates that this listener is synchronous and therefore will return a HL7 response to the caller. The HL7 codec is setup with <strong>codec=#hl7codec</strong>. Note that <code>hl7codec</code> is just a Spring bean ID, so it could be named <code>mygreatcodecforhl7</code> or whatever. The codec is also set up in the Spring XML file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    &lt;bean id=&quot;hl7codec&quot; class=&quot;org.apache.camel.component.hl7.HL7MLLPCodec&quot;&gt;
-        &lt;property name=&quot;charset&quot; value=&quot;iso-8859-1&quot;/&gt;
+</plain-text-body><h3 id="HL7-HL7MLLPprotocol">HL7 MLLP protocol</h3><p>HL7 is often used with the HL7 MLLP protocol, which is a text based TCP socket based protocol. This component ships with a Mina and Netty4 Codec that conforms to the MLLP protocol so you can easily expose an HL7 listener accepting HL7 requests over the TCP transport layer. To expose a HL7 listener service, the <a shape="rect" href="mina2.html">camel-mina2</a>&#160;or <a shape="rect" href="netty4.html">camel-netty4</a> component is used with the <code>HL7MLLPCodec</code>&#160;(mina2) or <code>HL7MLLPNettyDecoder/HL7MLLPNettyEncoder</code> (Netty4).</p><p>HL7 MLLP codec can be configured as follows:</p><parameter ac:name="class">confluenceTableSmall</parameter><rich-text-body><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="co
 nfluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>startByte</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0x0b</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The start byte spanning the HL7 payload.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>endByte1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0x1c</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The first end byte spanning the HL7 payload.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>endByte2</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0x0d</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The 2nd end byte spanning the HL7 payload.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>charset</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>JVM
  Default</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The encoding (a <a shape="rect" class="external-link" href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html" rel="nofollow">charset name</a>) to use for the codec. If not provided, Camel will use the <a shape="rect" class="external-link" href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html#defaultCharset()" rel="nofollow">JVM default Charset</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>produceString</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>true</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>(as of Camel 2.14.1)</strong> If true, the codec creates a string using the defined charset. If false, the codec sends a plain byte array into the route, so that the HL7 Data Format can determine the actual charset from the HL7 message content.</td></tr><tr><td colspan="1" rowspan="1" class="conflue
 nceTd"><p><code>convertLFtoCR</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd">Will convert <code>\n</code> to <code>\r</code> (<code>0x0d</code>, 13 decimal) as HL7 stipulates <code>\r</code> as segment terminators. The HAPI library requires the use of <code>\r</code>.</td></tr></tbody></table></div></rich-text-body><h4 id="HL7-ExposinganHL7listenerusingMina">Exposing an HL7 listener using Mina</h4><p>In the Spring XML file, we configure a mina2 endpoint to listen for HL7 requests using TCP on port <code>8888</code>:</p><parameter ac:name="">xml</parameter><plain-text-body>    &lt;endpoint id="hl7MinaListener" uri="mina2:tcp://localhost:8888?sync=true&amp;amp;codec=#hl7codec"/&gt;
+</plain-text-body><p><strong>sync=true</strong> indicates that this listener is synchronous and therefore will return a HL7 response to the caller. The HL7 codec is setup with <strong>codec=#hl7codec</strong>. Note that <code>hl7codec</code> is just a Spring bean ID, so it could be named <code>mygreatcodecforhl7</code> or whatever. The codec is also set up in the Spring XML file:</p><parameter ac:name="">xml</parameter><plain-text-body>    &lt;bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec"&gt;
+        &lt;property name="charset" value="iso-8859-1"/&gt;
     &lt;/bean&gt;
-]]></script>
-</div></div><p>The endpoint <strong>hl7MinaLlistener</strong> can then be used in a route as a consumer, as this Java DSL example illustrates:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    from(&quot;hl7MinaListener&quot;).beanRef(&quot;patientLookupService&quot;);
-]]></script>
-</div></div><p>This is a very simple route that will listen for HL7 and route it to a service named <strong>patientLookupService</strong>. This is also Spring bean ID, configured in the Spring XML as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    &lt;bean id=&quot;patientLookupService&quot; class=&quot;com.mycompany.healthcare.service.PatientLookupService&quot;/&gt;
-]]></script>
-</div></div><p>The business logic can be implemented in POJO classes that do not depend on Camel, as shown here:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[import ca.uhn.hl7v2.HL7Exception;
+</plain-text-body><p>The endpoint <strong>hl7MinaLlistener</strong> can then be used in a route as a consumer, as this Java DSL example illustrates:</p><parameter ac:name="">java</parameter><plain-text-body>    from("hl7MinaListener").beanRef("patientLookupService");
+</plain-text-body><p>This is a very simple route that will listen for HL7 and route it to a service named <strong>patientLookupService</strong>. This is also Spring bean ID, configured in the Spring XML as:</p><parameter ac:name="">xml</parameter><plain-text-body>    &lt;bean id="patientLookupService" class="com.mycompany.healthcare.service.PatientLookupService"/&gt;
+</plain-text-body><p>The business logic can be implemented in POJO classes that do not depend on Camel, as shown here:</p><parameter ac:name="">java</parameter><plain-text-body>import ca.uhn.hl7v2.HL7Exception;
 import ca.uhn.hl7v2.model.Message;
 import ca.uhn.hl7v2.model.v24.segment.QRD;
 
 public class PatientLookupService {
     public Message lookupPatient(Message input) throws HL7Exception {
-        QRD qrd = (QRD)input.get(&quot;QRD&quot;);
+        QRD qrd = (QRD)input.get("QRD");
         String patientId = qrd.getWhoSubjectFilter(0).getIDNumber().getValue();
 
         // find patient data based on the patient id and create a HL7 model object with the response
         Message response = ... create and set response data
         return response
     }
-]]></script>
-</div></div><h4 id="HL7-ExposinganHL7listenerusingNetty(availablefromCamel2.15onwards)">Exposing an HL7 listener using Netty (available from Camel 2.15 onwards)</h4><p>In the Spring XML file, we configure a netty4 endpoint to listen for HL7 requests using TCP on port <code>8888</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    &lt;endpoint id=&quot;hl7NettyListener&quot; uri=&quot;netty4:tcp://localhost:8888?sync=true&amp;amp;encoder=#hl7encoder&amp;amp;decoder=#hl7decoder&quot;/&gt;
-]]></script>
-</div></div><p><strong>sync=true</strong> indicates that this listener is synchronous and therefore will return a HL7 response to the caller. The HL7 codec is setup with <strong>encoder=#hl7encoder </strong>and<strong> decoder=#hl7decoder</strong>. Note that <code>hl7encoder</code> and <code>hl7decoder</code> are just bean IDs, so they could be named differently. The beans can be set in the Spring XML file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    &lt;bean id=&quot;hl7decoder&quot; class=&quot;org.apache.camel.component.hl7.HL7MLLPNettyDecoderFactory&quot;/&gt;
-    &lt;bean id=&quot;hl7encoder&quot; class=&quot;org.apache.camel.component.hl7.HL7MLLPNettyEncoderFactory&quot;/&gt;]]></script>
-</div></div><p>The endpoint <strong>hl7NettyListener</strong> can then be used in a route as a consumer, as this Java DSL example illustrates:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    from(&quot;hl7NettyListener&quot;).beanRef(&quot;patientLookupService&quot;);
-]]></script>
-</div></div><h3 id="HL7-HL7Modelusingjava.lang.Stringorbyte[]">HL7 Model using java.lang.String or byte[]</h3><p>The HL7 MLLP codec uses plain String as its data format. Camel uses its <a shape="rect" href="type-converter.html">Type Converter</a> to convert to/from strings to the HAPI HL7 model objects, but you can use the plain String objects if you prefer, for instance if you wish to parse the data yourself.</p><p>As of Camel 2.14.1 you can also let both the Mina and Netty codecs use a plain&#160;<code>byte[]</code> as its data format by setting the <code>produceString</code> property to false. The Type Converter is also capable of converting the&#160;<code>byte[]</code> to/from HAPI HL7 model objects.</p><h3 id="HL7-HL7v2ModelusingHAPI">HL7v2 Model using HAPI</h3><p>The HL7v2 model uses Java objects from the HAPI library. Using this library, you can encode and decode from the EDI format (ER7) that is mostly used with HL7v2.</p><p>The sample below is a request to lookup a patient 
 with the patient ID <code>0101701234</code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[MSH|^~\\&amp;|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4
+</plain-text-body><h4 id="HL7-ExposinganHL7listenerusingNetty(availablefromCamel2.15onwards)">Exposing an HL7 listener using Netty (available from Camel 2.15 onwards)</h4><p>In the Spring XML file, we configure a netty4 endpoint to listen for HL7 requests using TCP on port <code>8888</code>:</p><parameter ac:name="">xml</parameter><plain-text-body>    &lt;endpoint id="hl7NettyListener" uri="netty4:tcp://localhost:8888?sync=true&amp;amp;encoder=#hl7encoder&amp;amp;decoder=#hl7decoder"/&gt;
+</plain-text-body><p><strong>sync=true</strong> indicates that this listener is synchronous and therefore will return a HL7 response to the caller. The HL7 codec is setup with <strong>encoder=#hl7encoder </strong>and<strong> decoder=#hl7decoder</strong>. Note that <code>hl7encoder</code> and <code>hl7decoder</code> are just bean IDs, so they could be named differently. The beans can be set in the Spring XML file:</p><parameter ac:name="">xml</parameter><plain-text-body>    &lt;bean id="hl7decoder" class="org.apache.camel.component.hl7.HL7MLLPNettyDecoderFactory"/&gt;
+&#160;   &lt;bean id="hl7encoder" class="org.apache.camel.component.hl7.HL7MLLPNettyEncoderFactory"/&gt;</plain-text-body><p>The endpoint <strong>hl7NettyListener</strong> can then be used in a route as a consumer, as this Java DSL example illustrates:</p><parameter ac:name="">java</parameter><plain-text-body>    from("hl7NettyListener").beanRef("patientLookupService");
+</plain-text-body><h3 id="HL7-HL7Modelusingjava.lang.Stringorbyte[]">HL7 Model using java.lang.String or byte[]</h3><p>The HL7 MLLP codec uses plain String as its data format. Camel uses its <a shape="rect" href="type-converter.html">Type Converter</a> to convert to/from strings to the HAPI HL7 model objects, but you can use the plain String objects if you prefer, for instance if you wish to parse the data yourself.</p><p>As of Camel 2.14.1 you can also let both the Mina and Netty codecs use a plain&#160;<code>byte[]</code> as its data format by setting the <code>produceString</code> property to false. The Type Converter is also capable of converting the&#160;<code>byte[]</code> to/from HAPI HL7 model objects.</p><h3 id="HL7-HL7v2ModelusingHAPI">HL7v2 Model using HAPI</h3><p>The HL7v2 model uses Java objects from the HAPI library. Using this library, you can encode and decode from the EDI format (ER7) that is mostly used with HL7v2.</p><p>The sample below is a request to lookup a pa
 tient with the patient ID <code>0101701234</code>.</p><plain-text-body>MSH|^~\\&amp;|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4
 QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||
-]]></script>
-</div></div><p>Using the HL7 model you can work with a <code>ca.uhn.hl7v2.model.Message</code> object, e.g. to retrieve a patient ID:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[Message msg = exchange.getIn().getBody(Message.class);
-QRD qrd = (QRD)msg.get(&quot;QRD&quot;);
+</plain-text-body><p>Using the HL7 model you can work with a <code>ca.uhn.hl7v2.model.Message</code> object, e.g. to retrieve a patient ID:</p><parameter ac:name="">java</parameter><plain-text-body>Message msg = exchange.getIn().getBody(Message.class);
+QRD qrd = (QRD)msg.get("QRD");
 String patientId = qrd.getWhoSubjectFilter(0).getIDNumber().getValue();  // 0101701234
-]]></script>
-</div></div><p>This is powerful when combined with the HL7 listener, because you don't have to work with <code>byte[]</code>, <code>String</code> or any other simple object formats. You can just use the HAPI HL7v2 model objects. If you know the message type in advance, you can be more type-safe:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[QRY_A19 msg = exchange.getIn().getBody(QRY_A19.class);
+</plain-text-body><p>This is powerful when combined with the HL7 listener, because you don't have to work with <code>byte[]</code>, <code>String</code> or any other simple object formats. You can just use the HAPI HL7v2 model objects. If you know the message type in advance, you can be more type-safe:</p><parameter ac:name="">java</parameter><plain-text-body>QRY_A19 msg = exchange.getIn().getBody(QRY_A19.class);
 String patientId = msg.getQRD().getWhoSubjectFilter(0).getIDNumber().getValue();
-]]></script>
-</div></div><p>&#160;</p><p>&#160;</p><p></p><h3 id="HL7-HL7DataFormat">HL7 DataFormat</h3><p>The <a shape="rect" href="hl7.html">HL7</a> component ships with a HL7 data format that can be used to marshal or unmarshal HL7 model objects.</p><ul class="alternate"><li><code>marshal</code> = from Message to byte stream (can be used when responding using the HL7 MLLP codec)</li><li><code>unmarshal</code> = from byte stream to Message (can be used when receiving streamed data from the HL7 MLLP</li></ul><p>To use the data format, simply instantiate an instance and invoke the marshal or unmarshal operation in the route builder:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[  DataFormat hl7 = new HL7DataFormat();
-  ...
-  from(&quot;direct:hl7in&quot;).marshal(hl7).to(&quot;jms:queue:hl7out&quot;);
-]]></script>
-</div></div><p>In the sample above, the HL7 is marshalled from a HAPI Message object to a byte stream and put on a JMS queue.<br clear="none"> The next example is the opposite:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[  DataFormat hl7 = new HL7DataFormat();
-  ...
-  from(&quot;jms:queue:hl7out&quot;).unmarshal(hl7).to(&quot;patientLookupService&quot;);
-]]></script>
-</div></div><p>Here we unmarshal the byte stream into a HAPI Message object that is passed to our patient lookup service.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Serializable messages</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of HAPI 2.0 (used by <strong>Camel 2.11</strong>), the HL7v2 model classes are fully serializable. So you can put HL7v2 messages directly into a JMS queue (i.e. without calling <code>marshal()</code> and read them again directly from the queue (i.e. without calling <code>unmarshal()</code>.</p></div></div><div class="confluence-information-macro confluence-information-macro-note"><p class="title">Segment separators</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of <strong>Camel 2.11</stro
 ng>, <code>unmarshal</code> does not automatically fix segment separators anymore by converting <code>\n</code> to <code>\r</code>. If you <br clear="none"> need this conversion, <code>org.apache.camel.component.hl7.HL7#convertLFToCR</code> provides a handy <code>Expression</code> for this purpose.</p></div></div><div class="confluence-information-macro confluence-information-macro-note"><p class="title">Charset</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of <strong>Camel 2.14.1</strong>, both <code>marshal and unmarshal</code> evaluate the charset provided in the field&#160;<code>MSH-18</code>. If this field is empty, by default the charset contained in the corresponding Camel charset property/header is assumed. You can even change this default behavior by overriding the <code>guessCharsetName</code> method when inheriting from the <code>HL7DataFormat</code> class.</p></d
 iv></div><p>&#160;</p><p>There is a shorthand syntax in Camel for well-known data formats that are commonly used.<br clear="none"> Then you don't need to create an instance of the <code>HL7DataFormat</code> object:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[  from(&quot;direct:hl7in&quot;).marshal().hl7().to(&quot;jms:queue:hl7out&quot;);
-  from(&quot;jms:queue:hl7out&quot;).unmarshal().hl7().to(&quot;patientLookupService&quot;);
-]]></script>
-</div></div><p>&#160;</p><p>&#160;</p><h3 id="HL7-MessageHeaders">Message Headers</h3><p>The unmarshal operation adds these fields from the MSH segment as headers on the Camel message:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>MSH field</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Example</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7SendingApplication</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-3</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MYSERVER</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7SendingFacility</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-4</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
 <code>MYSERVERAPP</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7ReceivingApplication</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-5</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MYCLIENT</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7ReceivingFacility</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-6</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MYCLIENTAPP</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7Timestamp</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-7</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>20071231235900</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7Security</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><c
 ode>MSH-8</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7MessageType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-9-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ADT</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7TriggerEvent</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-9-2</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>A01</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7MessageControl</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-10</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1234</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7ProcessingId</code></p></td><td col
 span="1" rowspan="1" class="confluenceTd"><p><code>MSH-11</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>P</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7VersionId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-12</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>2.4</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>CamelHL7Context </code><code><br clear="none"></code></td><td colspan="1" rowspan="1" class="confluenceTd">-</td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>(Camel 2.14)</strong> contains the <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/HapiContext.html" rel="nofollow">HapiContext</a> that<br clear="none">was used to parse the message</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>CamelHL7Charset</code></td><td colspan="1" rowsp
 an="1" class="confluenceTd"><code>MSH-18</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>(Camel 2.14.1)</strong> <code><br clear="none">UNICODE UTF-8</code></td></tr></tbody></table></div></div>
-
-
-<p>All headers except&#160;<code>CamelHL7Context </code>are <code>String</code> types. If a header value is missing, its value is <code>null</code>.</p><h3 id="HL7-Options">Options</h3><p>The HL7 Data Format supports the following options:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>validate</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether the HAPI Parser should validate the message using the default validation rules. It is recommended to use the <code>parser</code> or <code>hapiContext</code> option and initialize it with the desired HAPI <a shape="rect" class="exte
 rnal-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html" rel="nofollow"><code>ValidationContext</code></a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>parser</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ca.uhn.hl7v2.parser.GenericParser</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Custom parser to be used. Must be of type <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/Parser.html" rel="nofollow"><code>ca.uhn.hl7v2.parser.Parser</code></a>. Note that <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/GenericParser.html" rel="nofollow"><code>GenericParser</code></a> also allows to parse XML-encoded HL7v2 messages</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>hapiContext</code></td><td colspan="1" rowspan="1" class="
 confluenceTd"><code>ca.uhn.hl7v2.DefaultHapiContext</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.14:</strong> Custom HAPI context that can define a custom parser, custom ValidationContext etc. This gives you full control over the HL7 parsing and rendering process.</td></tr></tbody></table></div></div>
-
-
-<h3 id="HL7-Dependencies">Dependencies</h3><p>To use HL7 in your Camel routes you'll need to add a dependency on <strong>camel-hl7</strong> listed above, which implements this data format.</p><p>The HAPI library is split into a <a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base" rel="nofollow">base library</a> and several structure libraries, one for each HL7v2 message version:</p><ul><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v21" rel="nofollow">v2.1 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v22" rel="nofollow">v2.2 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v23" rel="nofollow">v2.3 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/
 hapi-structures-v231" rel="nofollow">v2.3.1 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v24" rel="nofollow">v2.4 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v25" rel="nofollow">v2.5 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v251" rel="nofollow">v2.5.1 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v26" rel="nofollow">v2.6 structures library</a></li></ul><p>By default <code>camel-hl7</code> only references the HAPI <a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base" rel="nofollow">base library</a>. Applications are responsible for including structure libraries themselves. For example, if an 
 application works with HL7v2 message versions 2.4 and 2.5 then the following dependencies must be added:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+</plain-text-body><p>&#160;</p><p>&#160;</p><p><parameter ac:name=""><a shape="rect" href="hl7-dataformat.html">HL7 DataFormat</a></parameter></p><h3 id="HL7-MessageHeaders">Message Headers</h3><p>The unmarshal operation adds these fields from the MSH segment as headers on the Camel message:</p><parameter ac:name="class">confluenceTableSmall</parameter><rich-text-body><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>MSH field</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Example</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7SendingApplication</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-3</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MYSERVER</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7SendingFacili
 ty</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-4</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MYSERVERAPP</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7ReceivingApplication</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-5</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MYCLIENT</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7ReceivingFacility</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-6</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MYCLIENTAPP</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7Timestamp</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-7</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>20071231235900</code></p></td></tr
 ><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7Security</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-8</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7MessageType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-9-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ADT</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7TriggerEvent</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-9-2</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>A01</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7MessageControl</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-10</code></p></td><td colspan="1" rowspan="1" class="conf
 luenceTd"><p><code>1234</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7ProcessingId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-11</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>P</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHL7VersionId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MSH-12</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>2.4</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>CamelHL7Context </code><code><br clear="none"></code></td><td colspan="1" rowspan="1" class="confluenceTd">-</td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>(Camel 2.14)</strong> contains the <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/HapiContext.html" rel="nofollow">HapiContext</a> that<br clear="none">w
 as used to parse the message</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>CamelHL7Charset</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>MSH-18</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>(Camel 2.14.1)</strong> <code><br clear="none">UNICODE UTF-8</code></td></tr></tbody></table></div></rich-text-body><p>All headers except&#160;<code>CamelHL7Context </code>are <code>String</code> types. If a header value is missing, its value is <code>null</code>.</p><h3 id="HL7-Options">Options</h3><p>The HL7 Data Format supports the following options:</p><parameter ac:name="class">confluenceTableSmall</parameter><rich-text-body><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan
 ="1" class="confluenceTd"><p><code>validate</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether the HAPI Parser should validate the message using the default validation rules. It is recommended to use the <code>parser</code> or <code>hapiContext</code> option and initialize it with the desired HAPI <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html" rel="nofollow"><code>ValidationContext</code></a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>parser</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ca.uhn.hl7v2.parser.GenericParser</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Custom parser to be used. Must be of type <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/Parser.html" rel="n
 ofollow"><code>ca.uhn.hl7v2.parser.Parser</code></a>. Note that <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/GenericParser.html" rel="nofollow"><code>GenericParser</code></a> also allows to parse XML-encoded HL7v2 messages</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>hapiContext</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>ca.uhn.hl7v2.DefaultHapiContext</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.14:</strong> Custom HAPI context that can define a custom parser, custom ValidationContext etc. This gives you full control over the HL7 parsing and rendering process.</td></tr></tbody></table></div></rich-text-body><h3 id="HL7-Dependencies">Dependencies</h3><p>To use HL7 in your Camel routes you'll need to add a dependency on <strong>camel-hl7</strong> listed above, which implements this data format.</p><p>The HAPI library is split into a <a shape="
 rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base" rel="nofollow">base library</a> and several structure libraries, one for each HL7v2 message version:</p><ul><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v21" rel="nofollow">v2.1 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v22" rel="nofollow">v2.2 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v23" rel="nofollow">v2.3 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v231" rel="nofollow">v2.3.1 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v24" rel="nofollow">v2.4 structures library</a></li><li><a sh
 ape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v25" rel="nofollow">v2.5 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v251" rel="nofollow">v2.5.1 structures library</a></li><li><a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v26" rel="nofollow">v2.6 structures library</a></li></ul><p>By default <code>camel-hl7</code> only references the HAPI <a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base" rel="nofollow">base library</a>. Applications are responsible for including structure libraries themselves. For example, if an application works with HL7v2 message versions 2.4 and 2.5 then the following dependencies must be added:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
     &lt;groupId&gt;ca.uhn.hapi&lt;/groupId&gt;
     &lt;artifactId&gt;hapi-structures-v24&lt;/artifactId&gt;
     &lt;version&gt;2.2&lt;/version&gt;
@@ -181,31 +122,25 @@ String patientId = msg.getQRD().getWhoSu
     &lt;version&gt;2.2&lt;/version&gt;
     &lt;!-- use the same version as your hapi-base version --&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div><p>Alternatively, an OSGi bundle containing the base library, all structures libraries and required dependencies (on the bundle classpath) can be downloaded from the <a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-osgi-base" rel="nofollow">central Maven repository</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+</plain-text-body><p>Alternatively, an OSGi bundle containing the base library, all structures libraries and required dependencies (on the bundle classpath) can be downloaded from the <a shape="rect" class="external-link" href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-osgi-base" rel="nofollow">central Maven repository</a>.</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
     &lt;groupId&gt;ca.uhn.hapi&lt;/groupId&gt;
     &lt;artifactId&gt;hapi-osgi-base&lt;/artifactId&gt;
     &lt;version&gt;2.2&lt;/version&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div><h3 id="HL7-Terserlanguage">Terser language</h3><p><a shape="rect" class="external-link" href="http://hl7api.sourceforge.net" rel="nofollow">HAPI</a> provides a <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/util/Terser.html" rel="nofollow">Terser</a> class that provides access to fields using a commonly used terse location specification syntax. The Terser language allows to use this syntax to extract values from messages and to use them as expressions and predicates for filtering, content-based routing etc.</p><p>Sample:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[import static org.apache.camel.component.hl7.HL7.terser;
+</plain-text-body><h3 id="HL7-Terserlanguage">Terser language</h3><p><a shape="rect" class="external-link" href="http://hl7api.sourceforge.net" rel="nofollow">HAPI</a> provides a <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/util/Terser.html" rel="nofollow">Terser</a> class that provides access to fields using a commonly used terse location specification syntax. The Terser language allows to use this syntax to extract values from messages and to use them as expressions and predicates for filtering, content-based routing etc.</p><p>Sample:</p><parameter ac:name="">java</parameter><plain-text-body>import static org.apache.camel.component.hl7.HL7.terser;
 ...
 
    // extract patient ID from field QRD-8 in the QRY_A19 message above and put into message header
-   from(&quot;direct:test1&quot;)
-      .setHeader(&quot;PATIENT_ID&quot;,terser(&quot;QRD-8(0)-1&quot;))
-      .to(&quot;mock:test1&quot;);
-
-   // continue processing if extracted field equals a message header
-   from(&quot;direct:test2&quot;)
-      .filter(terser(&quot;QRD-8(0)-1&quot;).isEqualTo(header(&quot;PATIENT_ID&quot;))
-      .to(&quot;mock:test2&quot;);
-
-]]></script>
-</div></div><h3 id="HL7-HL7Validationpredicate">HL7 Validation predicate</h3><p>Often it is preferable to first parse a HL7v2 message and in a separate step validate it against a HAPI <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html" rel="nofollow">ValidationContext</a>.</p><p>Sample:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[import static org.apache.camel.component.hl7.HL7.messageConformsTo;
+   from("direct:test1")
+      .setHeader("PATIENT_ID",terser("QRD-8(0)-1"))
+      .to("mock:test1");
+
+  &#160;// continue processing if extracted field equals a message header
+   from("direct:test2")
+      .filter(terser("QRD-8(0)-1").isEqualTo(header("PATIENT_ID"))
+      .to("mock:test2");
+
+</plain-text-body><h3 id="HL7-HL7Validationpredicate">HL7 Validation predicate</h3><p>Often it is preferable to first parse a HL7v2 message and in a separate step validate it against a HAPI <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html" rel="nofollow">ValidationContext</a>.</p><p>Sample:</p><parameter ac:name="">java</parameter><plain-text-body>import static org.apache.camel.component.hl7.HL7.messageConformsTo;
 import ca.uhn.hl7v2.validation.impl.DefaultValidation;
 ...
 
@@ -213,25 +148,23 @@ import ca.uhn.hl7v2.validation.impl.Defa
    ValidationContext defaultContext = new DefaultValidation(); 
 
    // Throws PredicateValidationException if message does not validate
-   from(&quot;direct:test1&quot;)
+   from("direct:test1")
       .validate(messageConformsTo(defaultContext))
-      .to(&quot;mock:test1&quot;);
-]]></script>
-</div></div><h3 id="HL7-HL7ValidationpredicateusingtheHapiContext(Camel2.14)">HL7 Validation predicate using the HapiContext (Camel 2.14)</h3><p>The HAPI Context is always configured with a <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html" rel="nofollow">ValidationContext</a> (or a <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/builder/ValidationRuleBuilder.html" rel="nofollow">ValidationRuleBuilder</a>), so you can access the validation rules indirectly. Furthermore, when unmarshalling the HL7DataFormat forwards the configured HAPI context in the <code>CamelHL7Context</code> header, and the validation rules of this context can be easily reused:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[import static org.apache.camel.component.hl7.HL7.messageConformsTo;
+      .to("mock:test1");
+</plain-text-body><h3 id="HL7-HL7ValidationpredicateusingtheHapiContext(Camel2.14)">HL7 Validation predicate using the HapiContext (Camel 2.14)</h3><p>The HAPI Context is always configured with a <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html" rel="nofollow">ValidationContext</a> (or a <a shape="rect" class="external-link" href="http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/builder/ValidationRuleBuilder.html" rel="nofollow">ValidationRuleBuilder</a>), so you can access the validation rules indirectly. Furthermore, when unmarshalling the HL7DataFormat forwards the configured HAPI context in the <code>CamelHL7Context</code> header, and the validation rules of this context can be easily reused:</p><parameter ac:name="">java</parameter><plain-text-body>import static org.apache.camel.component.hl7.HL7.messageConformsTo;
 import static org.apache.camel.component.hl7.HL7.messageConforms
 ...
 
   HapiContext hapiContext = new DefaultHapiContext();
-  hapiContext.getParserConfiguration().setValidating(false); // don&#39;t validate during parsing
+  hapiContext.getParserConfiguration().setValidating(false); // don't validate during parsing
   
   // customize HapiContext some more ... e.g. enforce that PID-8 in ADT_A01 messages of version 2.4 is not empty
   ValidationRuleBuilder builder = new ValidationRuleBuilder() {
       @Override
       protected void configure() {
          forVersion(Version.V24)
-              .message(&quot;ADT&quot;, &quot;A01&quot;)
-              .terser(&quot;PID-8&quot;, not(empty()));
+              .message("ADT", "A01")
+              .terser("PID-8", not(empty()));
          }
       };
   hapiContext.setValidationRuleBuilder(builder);
@@ -239,13 +172,11 @@ import static org.apache.camel.component
   HL7DataFormat hl7 = new HL7DataFormat();
   hl7.setHapiContext(hapiContext);
 
-  from(&quot;direct:test1&quot;)
+  from("direct:test1")
      .unmarshal(hl7)                // uses the GenericParser returned from the HapiContext
      .validate(messageConforms())   // uses the validation rules returned from the HapiContext
                                     // equivalent with .validate(messageConformsTo(hapiContext))
-     // route continues from here]]></script>
-</div></div><p>&#160;</p><h3 id="HL7-HL7Acknowledgementexpression">HL7 Acknowledgement expression</h3><p>A common task in HL7v2 processing is to generate an acknowledgement message as response to an incoming HL7v2 message, e.g. based on a validation result. The <code>ack</code> expression lets us accomplish this very elegantly:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[import static org.apache.camel.component.hl7.HL7.messageConformsTo;
+     // route continues from here</plain-text-body><p>&#160;</p><h3 id="HL7-HL7Acknowledgementexpression">HL7 Acknowledgement expression</h3><p>A common task in HL7v2 processing is to generate an acknowledgement message as response to an incoming HL7v2 message, e.g. based on a validation result. The <code>ack</code> expression lets us accomplish this very elegantly:</p><parameter ac:name="">java</parameter><plain-text-body>import static org.apache.camel.component.hl7.HL7.messageConformsTo;
 import static org.apache.camel.component.hl7.HL7.ack;
 import ca.uhn.hl7v2.validation.impl.DefaultValidation;
 ...
@@ -253,7 +184,7 @@ import ca.uhn.hl7v2.validation.impl.Defa
   // Use standard or define your own validation rules
    ValidationContext defaultContext = new DefaultValidation(); 
 
-   from(&quot;direct:test1&quot;)
+   from("direct:test1")
       .onException(Exception.class)
          .handled(true)
          .transform(ack()) // auto-generates negative ack because of exception in Exchange
@@ -263,70 +194,7 @@ import ca.uhn.hl7v2.validation.impl.Defa
       ...
       // acknowledgement
       .transform(ack())
-]]></script>
-</div></div><h3 id="HL7-MoreSamples">More Samples</h3><p>In the following example, a plain <code>String</code> HL7 request is sent to an HL7 listener that sends back a response:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-String line1 = &quot;MSH|^~\\&amp;|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4&quot;;
-String line2 = &quot;QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||&quot;;
-
-StringBuilder in = new StringBuilder();
-in.append(line1);
-in.append(&quot;\n&quot;);
-in.append(line2);
-
-String out = template.requestBody(&quot;mina2:tcp://127.0.0.1:&quot; + getPort() + &quot;?sync=true&amp;codec=#hl7codec&quot;, in.toString(), String.class);
-]]></script>
-</div></div><p>In the next sample, HL7 requests from the HL7 listener are routed to the business logic, which is implemented as plain POJO registered in the registry as <code>hl7service</code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-public class MyHL7BusinessLogic {
-
-    // This is a plain POJO that has NO imports whatsoever on Apache Camel.
-    // its a plain POJO only importing the HAPI library so we can much easier work with the HL7 format.
-
-    public Message handleA19(Message msg) throws Exception {
-        // here you can have your business logic for A19 messages
-        assertTrue(msg instanceof QRY_A19);
-        // just return the same dummy response
-        return createADR19Message();
-    }
-
-    public Message handleA01(Message msg) throws Exception {
-        // here you can have your business logic for A01 messages
-        assertTrue(msg instanceof ADT_A01);
-        // just return the same dummy response
-        return createADT01Message(((ADT_A01)msg).getMSH().getMessageControlID().getValue());
-    }
-}
-]]></script>
-</div></div><p>Then the Camel routes using the <code>RouteBuilder</code> may look as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-DataFormat hl7 = new HL7DataFormat();
-// we setup or HL7 listener on port 8888 (using the hl7codec) and in sync mode so we can return a response
-from(&quot;mina2:tcp://127.0.0.1:&quot; + getPort() + &quot;?sync=true&amp;codec=#hl7codec&quot;)
-    // we use the HL7 data format to unmarshal from HL7 stream to the HAPI Message model
-    // this ensures that the camel message has been enriched with hl7 specific headers to
-    // make the routing much easier (see below)
-    .unmarshal(hl7)
-    // using choice as the content base router
-    .choice()
-        // where we choose that A19 queries invoke the handleA19 method on our hl7service bean
-        .when(header(&quot;CamelHL7TriggerEvent&quot;).isEqualTo(&quot;A19&quot;))
-            .bean(&quot;hl7service&quot;, &quot;handleA19&quot;)
-            .to(&quot;mock:a19&quot;)
-        // and A01 should invoke the handleA01 method on our hl7service bean
-        .when(header(&quot;CamelHL7TriggerEvent&quot;).isEqualTo(&quot;A01&quot;)).to(&quot;mock:a01&quot;)
-            .bean(&quot;hl7service&quot;, &quot;handleA01&quot;)
-            .to(&quot;mock:a19&quot;)
-        // other types should go to mock:unknown
-        .otherwise()
-            .to(&quot;mock:unknown&quot;)
-    // end choice block
-    .end()
-    // marshal response back
-    .marshal(hl7);
-]]></script>
-</div></div><p>Note that by using the HL7 DataFormat the Camel message headers are populated with the fields from the MSH segment. The headers are particularly useful for filtering or content-based routing as shown in the example above.</p><p>&#160;</p><p></p><h3 id="HL7-SeeAlso">See Also</h3>
-<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul></div>
+</plain-text-body><h3 id="HL7-MoreSamples">More Samples</h3><p>In the following example, a plain <code>String</code> HL7 request is sent to an HL7 listener that sends back a response:</p><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecTest.java}</plain-text-body><p>In the next sample, HL7 requests from the HL7 listener are routed to the business logic, which is implemented as plain POJO registered in the registry as <code>hl7service</code>.</p><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7RouteTest.java}</plain-text-body><p>Then the Camel routes using the <code>RouteBuilder</code> may look as follows:</p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7RouteTest.java}</plain-text-body><p>Note that by using the HL7 DataFormat the Camel messa
 ge headers are populated with the fields from the MSH segment. The headers are particularly useful for filtering or content-based routing as shown in the example above.</p><p>&#160;</p><p><parameter ac:name=""><a shape="rect" href="endpoint-see-also.html">Endpoint See Also</a></parameter></p></div>
         </td>
         <td valign="top">
           <div class="navigation">

Modified: websites/production/camel/content/how-do-i-add-a-component.html
==============================================================================
--- websites/production/camel/content/how-do-i-add-a-component.html (original)
+++ websites/production/camel/content/how-do-i-add-a-component.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: How do I add a component
@@ -86,31 +75,11 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="HowdoIaddacomponent-HowdoIaddacomponent">How do I add a component</h2><p>You might first want to read <a shape="rect" href="writing-components.html">Writing Components</a> for a background in how to implement a new component.<br clear="none"> Typically it means you write an implementation of the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Component.html">Component</a> interface, usually deriving from <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultComponent.html">DefaultComponent</a>.</p><p>You can then register your component explicitly via</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[CamelContext context = new DefaultCamelContext();
-context.addComponent(&quot;foo&quot;, new FooComponent(context));
-]]></script>
-</div></div><p>However you can use the auto-discovery feature of Camel where by Camel will automatically add a <a shape="rect" href="component.html">Component</a> when an endpoint URI is used. To do this you would create a file called</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[/META-INF/services/org/apache/camel/component/foo
-]]></script>
-</div></div><p>with contents</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[class=org.acme.FooComponent
-]]></script>
-</div></div><p>(you can add other property configurations in there too if you like)</p><p>Then if you refer to an endpoint as <strong><code>foo://somethingOrOther</code></strong> Camel will auto-discover your component and register it.</p><p>The&#160;<strong><code>FooComponent</code></strong> can then be auto-injected with resources using the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/Injector.html">Injector</a>, such as to support <a shape="rect" href="spring.html">Spring</a> based auto-wiring, or to support&#160;<strong><code>@Resource</code></strong> (EJB3 style) injection or Guice style&#160;<strong><code>@Inject</code></strong> injection.</p><h3 id="HowdoIaddacomponent-WorkingwithSpringXML">Working with Spring XML</h3><p>You can configure a component via Spring using the following mechanism...</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;jmxAgent id=&quot;agent&quot; disabled=&quot;true&quot;/&gt;
-&lt;/camelContext&gt;
-
-&lt;bean id=&quot;activemq&quot; class=&quot;org.apache.activemq.camel.component.ActiveMQComponent&quot;&gt;
-  &lt;property name=&quot;connectionFactory&quot;&gt;
-    &lt;bean class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;&gt;
-      &lt;property name=&quot;brokerURL&quot; value=&quot;vm://localhost?broker.persistent=false&amp;amp;broker.useJmx=false&quot;/&gt;
-    &lt;/bean&gt;
-  &lt;/property&gt;
-&lt;/bean&gt;
-]]></script>
-</div></div>Which allows you to configure a component using some name (activemq in the above example), then you can refer to the component using <strong><code>activemq:[queue:|topic:]destinationName</code></strong>.<p>If you want to add explicit Spring 2.x XML objects to your XML then you could use the&#160;<strong><code>xbean-spring</code></strong> which tries to automate most of the XML binding work for you; or you could look in camel-spring at&#160;<strong><code>CamelNamespaceHandler</code></strong> you'll see how we handle the Spring XML stuff (warning its kinda hairy code to look at <img class="emoticon emoticon-smile" src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)">. If you wanted&#160;<strong><code>&lt;fooComponent&gt;</code></strong> to be a standard part of the core Camel schema then you'd hack that file to add your component &amp; <a shape="rect" hr
 ef="contributing.html">conftribute a patch</a> to the camel XSD. Otherwise you could write your own namespace &amp; schema if you prefer.</p><h3 id="HowdoIaddacomponent-SeeAlso">See Also</h3><ul><li><a shape="rect" href="writing-components.html">Writing Components</a></li><li><a shape="rect" href="how-do-i-configure-endpoints.html">How Do I Configure Endpoints?</a></li></ul></div>
+<div class="wiki-content maincontent"><h2 id="HowdoIaddacomponent-HowdoIaddacomponent">How do I add a component</h2><p>You might first want to read <a shape="rect" href="writing-components.html">Writing Components</a> for a background in how to implement a new component.<br clear="none"> Typically it means you write an implementation of the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Component.html">Component</a> interface, usually deriving from <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultComponent.html">DefaultComponent</a>.</p><p>You can then register your component explicitly via</p><plain-text-body>CamelContext context = new DefaultCamelContext();
+context.addComponent("foo", new FooComponent(context));
+</plain-text-body><p>However you can use the auto-discovery feature of Camel where by Camel will automatically add a <a shape="rect" href="component.html">Component</a> when an endpoint URI is used. To do this you would create a file called</p><plain-text-body>/META-INF/services/org/apache/camel/component/foo
+</plain-text-body><p>with contents</p><plain-text-body>class=org.acme.FooComponent
+</plain-text-body><p>(you can add other property configurations in there too if you like)</p><p>Then if you refer to an endpoint as <strong><code>foo://somethingOrOther</code></strong> Camel will auto-discover your component and register it.</p><p>The&#160;<strong><code>FooComponent</code></strong> can then be auto-injected with resources using the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/Injector.html">Injector</a>, such as to support <a shape="rect" href="spring.html">Spring</a> based auto-wiring, or to support&#160;<strong><code>@Resource</code></strong> (EJB3 style) injection or Guice style&#160;<strong><code>@Inject</code></strong> injection.</p><h3 id="HowdoIaddacomponent-WorkingwithSpringXML">Working with Spring XML</h3><p>You can configure a component via Spring using the following mechanism...<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jms/src/test/resources/o
 rg/apache/camel/component/jms/jmsRouteUsingSpring.xml}</plain-text-body>Which allows you to configure a component using some name (activemq in the above example), then you can refer to the component using <strong><code>activemq:[queue:|topic:]destinationName</code></strong>.</p><p>If you want to add explicit Spring 2.x XML objects to your XML then you could use the&#160;<strong><code>xbean-spring</code></strong> which tries to automate most of the XML binding work for you; or you could look in camel-spring at&#160;<strong><code>CamelNamespaceHandler</code></strong> you'll see how we handle the Spring XML stuff (warning its kinda hairy code to look at <img class="emoticon emoticon-smile" src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)">. If you wanted&#160;<strong><code>&lt;fooComponent&gt;</code></strong> to be a standard part of the core Camel schema then you
 'd hack that file to add your component &amp; <a shape="rect" href="contributing.html">conftribute a patch</a> to the camel XSD. Otherwise you could write your own namespace &amp; schema if you prefer.</p><h3 id="HowdoIaddacomponent-SeeAlso">See Also</h3><ul><li><a shape="rect" href="writing-components.html">Writing Components</a></li><li><a shape="rect" href="how-do-i-configure-endpoints.html">How Do I Configure Endpoints?</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">