Author: buildbot
Date: Fri Aug 24 15:19:56 2012
New Revision: 830028
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-component-appendix.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/hl7.html
Modified: websites/production/camel/content/book-component-appendix.html
==============================================================================
--- websites/production/camel/content/book-component-appendix.html (original)
+++ websites/production/camel/content/book-component-appendix.html Fri Aug 24
15:19:56 2012
@@ -6625,7 +6625,7 @@ hibernate:[entityClassName][?options]
<p>The <b>hl7</b> component is used for working with the HL7 MLLP protocol and
<a shape="rect" class="external-link" href="http://www.hl7.org/"
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" type="square"><li>HL7 MLLP codec for <a shape="rect"
class="external-link" href="http://mina.apache.org/">Mina</a></li><li>Agnostic
data format using either plain String objects or HAPI HL7 model
objects.</li><li><a shape="rect" href="type-converter.html" title="Type
Converter">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat
using HAPI library</li><li>Even more ease-of-use as it's integrated well with
the <a shape="rect" href="mina.html" title="MINA">camel-mina</a>
component.</li></ul>
+<ul class="alternate" type="square"><li>HL7 MLLP codec for <a shape="rect"
class="external-link" href="http://mina.apache.org/">Mina</a></li><li>Agnostic
data format using either plain String objects or HAPI HL7 model
objects.</li><li><a shape="rect" href="type-converter.html" title="Type
Converter">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat
using HAPI library</li><li>Even more ease-of-use as it's integrated well with
the <a shape="rect" href="mina.html" title="MINA">camel-mina</a> (<b>Camel
2.11</b>: <span class="error">[camel-mina2]</span> ) component.</li></ul>
<p>Maven users will need to add the following dependency to their
<tt>pom.xml</tt> for this component:</p>
@@ -6643,7 +6643,7 @@ hibernate:[entityClassName][?options]
<h3><a shape="rect" name="BookComponentAppendix-HL7MLLPprotocol"></a>HL7 MLLP
protocol</h3>
<p>HL7 is often used with the HL7 MLLP protocol that is a text based TCP
socket based protocol. This component ships with a Mina Codec that conforms to
the MLLP protocol so you can easily expose a HL7 listener that accepts HL7
requests over the TCP transport. </p>
-<p>To expose a HL7 listener service we reuse the existing <a shape="rect"
href="mina.html" title="MINA">camel-mina</a> component where we just use the
<tt>HL7MLLPCodec</tt> as codec.</p>
+<p>To expose a HL7 listener service we reuse the existing mina/mina2 component
where we just use the <tt>HL7MLLPCodec</tt> as codec.</p>
<p>The HL7 MLLP codec has the following options:</p>
<div class="confluenceTableSmall"><div class="table-wrap">
@@ -6656,9 +6656,10 @@ hibernate:[entityClassName][?options]
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag"><endpoint id=<span
class="code-quote">"hl7listener"</span> uri=<span
class="code-quote">"mina:tcp://localhost:8888?sync=true&amp;codec=#hl7codec"</span>/></span>
+ <span class="code-tag"><span class="code-comment"><!-- Camel 2.11:
uri="mina2:tcp... --></span></span>
</pre>
</div></div>
-<p>Notice we configure it to use <a shape="rect" href="mina.html"
title="MINA">camel-mina</a> with TCP on the <tt>localhost</tt> on port
<tt>8888</tt>. We use <b>sync=true</b> to indicate that this listener is
synchronous and therefore will return a HL7 response to the caller. Then we
setup mina to use our HL7 codec with <b>codec=#hl7codec</b>. Notice that
<tt>hl7codec</tt> is just a Spring bean ID, so we could have named it
<tt>mygreatcodecforhl7</tt> or whatever. The codec is also set up in the Spring
XML file:</p>
+<p>Notice that we use TCP on <tt>localhost</tt> on port <tt>8888</tt>. We use
<b>sync=true</b> to indicate that this listener is synchronous and therefore
will return a HL7 response to the caller. Then we setup mina to use our HL7
codec with <b>codec=#hl7codec</b>. Notice that <tt>hl7codec</tt> is just a
Spring bean ID, so we could have named it <tt>mygreatcodecforhl7</tt> or
whatever. The codec is also set up in the Spring XML file:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag"><bean id=<span
class="code-quote">"hl7codec"</span> class=<span
class="code-quote">"org.apache.camel.component.hl7.HL7MLLPCodec"</span>></span>
@@ -6792,7 +6793,7 @@ Then you don't need to create an instanc
<h3><a shape="rect" name="BookComponentAppendix-Options"></a>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"> Option </th><th colspan="1" rowspan="1"
class="confluenceTh"> Default </th><th colspan="1" rowspan="1"
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"> validate </td><td colspan="1" rowspan="1"
class="confluenceTd"> true </td><td colspan="1" rowspan="1"
class="confluenceTd"> Whether the HAPI Parser should validate.
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>parser</tt>
</td><td colspan="1" rowspan="1" class="confluenceTd">
<tt>ca.uhn.hl7v2.parser.PipeParser</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> <b>Camel 2.11:</b> To use a custom parser. Must be of
type <tt>ca.uhn.hl7v2.parser.Parser</tt>. </td></tr></tbody></table>
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"> Option </th><th colspan="1" rowspan="1"
class="confluenceTh"> Default </th><th colspan="1" rowspan="1"
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"> <tt>validate</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> true </td><td colspan="1" rowspan="1"
class="confluenceTd"> Whether the HAPI Parser should validate using the default
validation rules. <b>Camel 2.11:</b> better use the <tt>parser</tt> option and
initialize the parser with the desired HAPI <tt>ValidationContext</tt>
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>parser</tt>
</td><td colspan="1" rowspan="1" class="confluenceTd">
<tt>ca.uhn.hl7v2.parser.GenericParser</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> <b>Camel 2.11:</b> To use a custom parser. Must be of
type <tt>ca.uhn.hl7v2.parser.Parser</tt>. Note that <tt>GenericParse
r</tt> also allows to parse XML-encoded HL7v2 messages.
</td></tr></tbody></table>
</div>
</div>
@@ -6801,12 +6802,12 @@ Then you don't need to create an instanc
<p>To use HL7 in your Camel routes you'll need to add a dependency on
<b>camel-hl7</b> listed above, which implements this data format. </p>
-<p>The HAPI library since Version 0.6 has been split into a <a shape="rect"
class="external-link"
href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base/1.2/"
rel="nofollow">base library</a> and several structure libraries, one for each
HL7v2 message version:</p>
+<p>The HAPI library since Version 0.6 has been 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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
rel="nofollow">v2.6 structures library</a></li></ul>
+<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="externa
l-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 <tt>camel-hl7</tt> only references the HAPI <a shape="rect"
class="external-link"
href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base/1.2/"
rel="nofollow">base library</a>. Applications are responsible for including
structure libraries themselves. For example, if a application works with HL7v2
message versions 2.4 and 2.5 then the following dependencies must be added:</p>
+<p>By default <tt>camel-hl7</tt> 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 a application works with HL7v2 message versions 2.4
and 2.5 then the following dependencies must be added:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
@@ -6814,16 +6815,18 @@ Then you don't need to create an instanc
<span class="code-tag"><groupId></span>ca.uhn.hapi<span
class="code-tag"></groupId></span>
<span class="code-tag"><artifactId></span>hapi-structures-v24<span
class="code-tag"></artifactId></span>
<span class="code-tag"><version></span>1.2<span
class="code-tag"></version></span>
+ <span class="code-tag"><span class="code-comment"><!-- use the same
version as your hapi-base version --></span></span>
<span class="code-tag"></dependency></span>
<span class="code-tag"><dependency></span>
<span class="code-tag"><groupId></span>ca.uhn.hapi<span
class="code-tag"></groupId></span>
<span class="code-tag"><artifactId></span>hapi-structures-v25<span
class="code-tag"></artifactId></span>
<span class="code-tag"><version></span>1.2<span
class="code-tag"></version></span>
+ <span class="code-tag"><span class="code-comment"><!-- use the same
version as your hapi-base version --></span></span>
<span class="code-tag"></dependency></span>
</pre>
</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/1.2/"
rel="nofollow">central Maven repository</a>. </p>
+<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" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
@@ -6835,9 +6838,84 @@ Then you don't need to create an instanc
</pre>
</div></div>
-<p>Note that the version number must match the version of the hapi-base
library that is transitively referenced by this component.</p>
-<h3><a shape="rect" name="BookComponentAppendix-Samples"></a>Samples</h3>
+<h3><a shape="rect"
name="BookComponentAppendix-Terserlanguage%28Camel2.11%29"></a>Terser language
(<b>Camel 2.11</b>)</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" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span> org.apache.camel.component.hl7.HL7.terser;
+...
+
+ <span class="code-comment">// extract patient ID from field QRD-8 in the
QRY_A19 message above and put into message header
+</span> from(<span class="code-quote">"direct:test1"</span>)
+ .setHeader(<span class="code-quote">"PATIENT_ID"</span>,terser(<span
class="code-quote">"QRD-8(0)-1"</span>))
+ .to(<span class="code-quote">"mock:test1"</span>);
+ <span class="code-comment">// <span class="code-keyword">continue</span>
processing <span class="code-keyword">if</span> extracted field equals a
message header
+</span> from(<span class="code-quote">"direct:test2"</span>)
+ .filter(terser(<span class="code-quote">"QRD-8(0)-1"</span>)
+ .isEqualTo(header(<span class="code-quote">"PATIENT_ID"</span>))
+ .to(<span class="code-quote">"mock:test2"</span>);
+
+</pre>
+</div></div>
+
+
+<h3><a shape="rect"
name="BookComponentAppendix-HL7Validationpredicate%28Camel2.11%29"></a>HL7
Validation predicate (<b>Camel 2.11</b>)</h3>
+
+<p>Often it is preferable to parse a HL7v2 message and 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> in a separate step afterwards.</p>
+
+<p>Sample:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span>
org.apache.camel.component.hl7.HL7.messageConformsTo;
+<span class="code-keyword">import</span>
ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+ <span class="code-comment">// Use standard or define your own validation
rules
+</span> ValidationContext defaultContext = <span
class="code-keyword">new</span> DefaultValidation();
+
+ <span class="code-comment">// Throws PredicateValidationException <span
class="code-keyword">if</span> message does not validate
+</span> from(<span
class="code-quote">"direct:test1"</span>).validate(messageConformsTo(defaultContext)).to(<span
class="code-quote">"mock:test1"</span>);
+</pre>
+</div></div>
+
+
+<h3><a shape="rect"
name="BookComponentAppendix-HL7Acknowledgementexpression%28Camel2.11%29"></a>HL7
Acknowledgement expression (<b>Camel 2.11</b>)</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 <tt>ack</tt> expression lets us accomplish this very elegantly:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span>
org.apache.camel.component.hl7.HL7.messageConformsTo;
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span> org.apache.camel.component.hl7.HL7.ack;
+<span class="code-keyword">import</span>
ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+ <span class="code-comment">// Use standard or define your own validation
rules
+</span> ValidationContext defaultContext = <span
class="code-keyword">new</span> DefaultValidation();
+
+ from(<span class="code-quote">"direct:test1"</span>)
+ .onException(Exception.class)
+ .handled(<span class="code-keyword">true</span>)
+ .transform(ack()) <span class="code-comment">// auto-generates
negative ack because of exception in Exchange
+</span> .end()
+ .validate(messageConformsTo(defaultContext))
+ <span class="code-comment">// <span class="code-keyword">do</span>
something meaningful here
+</span> ...
+ <span class="code-comment">// acknowledgement
+</span> .transform(ack())
+</pre>
+</div></div>
+
+
+<h3><a shape="rect" name="BookComponentAppendix-MoreSamples"></a>More
Samples</h3>
<p>In the following example we send a HL7 request to a HL7 listener and
retrieves a response. We use plain <tt>String</tt> types in this example:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-java"><span class="code-object">String</span> line1 = <span
class="code-quote">"MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4"</span>;
Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Fri Aug 24 15:19:56
2012
@@ -27224,7 +27224,7 @@ hibernate:[entityClassName][?options]
<p>The <b>hl7</b> component is used for working with the HL7 MLLP protocol and
<a shape="rect" class="external-link" href="http://www.hl7.org/"
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" type="square"><li>HL7 MLLP codec for <a shape="rect"
class="external-link" href="http://mina.apache.org/">Mina</a></li><li>Agnostic
data format using either plain String objects or HAPI HL7 model
objects.</li><li><a shape="rect" href="type-converter.html" title="Type
Converter">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat
using HAPI library</li><li>Even more ease-of-use as it's integrated well with
the <a shape="rect" href="mina.html" title="MINA">camel-mina</a>
component.</li></ul>
+<ul class="alternate" type="square"><li>HL7 MLLP codec for <a shape="rect"
class="external-link" href="http://mina.apache.org/">Mina</a></li><li>Agnostic
data format using either plain String objects or HAPI HL7 model
objects.</li><li><a shape="rect" href="type-converter.html" title="Type
Converter">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat
using HAPI library</li><li>Even more ease-of-use as it's integrated well with
the <a shape="rect" href="mina.html" title="MINA">camel-mina</a> (<b>Camel
2.11</b>: <span class="error">[camel-mina2]</span> ) component.</li></ul>
<p>Maven users will need to add the following dependency to their
<tt>pom.xml</tt> for this component:</p>
@@ -27242,7 +27242,7 @@ hibernate:[entityClassName][?options]
<h3><a shape="rect" name="BookInOnePage-HL7MLLPprotocol"></a>HL7 MLLP
protocol</h3>
<p>HL7 is often used with the HL7 MLLP protocol that is a text based TCP
socket based protocol. This component ships with a Mina Codec that conforms to
the MLLP protocol so you can easily expose a HL7 listener that accepts HL7
requests over the TCP transport. </p>
-<p>To expose a HL7 listener service we reuse the existing <a shape="rect"
href="mina.html" title="MINA">camel-mina</a> component where we just use the
<tt>HL7MLLPCodec</tt> as codec.</p>
+<p>To expose a HL7 listener service we reuse the existing mina/mina2 component
where we just use the <tt>HL7MLLPCodec</tt> as codec.</p>
<p>The HL7 MLLP codec has the following options:</p>
<div class="confluenceTableSmall"><div class="table-wrap">
@@ -27255,9 +27255,10 @@ hibernate:[entityClassName][?options]
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag"><endpoint id=<span
class="code-quote">"hl7listener"</span> uri=<span
class="code-quote">"mina:tcp://localhost:8888?sync=true&amp;codec=#hl7codec"</span>/></span>
+ <span class="code-tag"><span class="code-comment"><!-- Camel 2.11:
uri="mina2:tcp... --></span></span>
</pre>
</div></div>
-<p>Notice we configure it to use <a shape="rect" href="mina.html"
title="MINA">camel-mina</a> with TCP on the <tt>localhost</tt> on port
<tt>8888</tt>. We use <b>sync=true</b> to indicate that this listener is
synchronous and therefore will return a HL7 response to the caller. Then we
setup mina to use our HL7 codec with <b>codec=#hl7codec</b>. Notice that
<tt>hl7codec</tt> is just a Spring bean ID, so we could have named it
<tt>mygreatcodecforhl7</tt> or whatever. The codec is also set up in the Spring
XML file:</p>
+<p>Notice that we use TCP on <tt>localhost</tt> on port <tt>8888</tt>. We use
<b>sync=true</b> to indicate that this listener is synchronous and therefore
will return a HL7 response to the caller. Then we setup mina to use our HL7
codec with <b>codec=#hl7codec</b>. Notice that <tt>hl7codec</tt> is just a
Spring bean ID, so we could have named it <tt>mygreatcodecforhl7</tt> or
whatever. The codec is also set up in the Spring XML file:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag"><bean id=<span
class="code-quote">"hl7codec"</span> class=<span
class="code-quote">"org.apache.camel.component.hl7.HL7MLLPCodec"</span>></span>
@@ -27391,7 +27392,7 @@ Then you don't need to create an instanc
<h3><a shape="rect" name="BookInOnePage-Options"></a>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"> Option </th><th colspan="1" rowspan="1"
class="confluenceTh"> Default </th><th colspan="1" rowspan="1"
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"> validate </td><td colspan="1" rowspan="1"
class="confluenceTd"> true </td><td colspan="1" rowspan="1"
class="confluenceTd"> Whether the HAPI Parser should validate.
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>parser</tt>
</td><td colspan="1" rowspan="1" class="confluenceTd">
<tt>ca.uhn.hl7v2.parser.PipeParser</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> <b>Camel 2.11:</b> To use a custom parser. Must be of
type <tt>ca.uhn.hl7v2.parser.Parser</tt>. </td></tr></tbody></table>
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"> Option </th><th colspan="1" rowspan="1"
class="confluenceTh"> Default </th><th colspan="1" rowspan="1"
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"> <tt>validate</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> true </td><td colspan="1" rowspan="1"
class="confluenceTd"> Whether the HAPI Parser should validate using the default
validation rules. <b>Camel 2.11:</b> better use the <tt>parser</tt> option and
initialize the parser with the desired HAPI <tt>ValidationContext</tt>
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>parser</tt>
</td><td colspan="1" rowspan="1" class="confluenceTd">
<tt>ca.uhn.hl7v2.parser.GenericParser</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> <b>Camel 2.11:</b> To use a custom parser. Must be of
type <tt>ca.uhn.hl7v2.parser.Parser</tt>. Note that <tt>GenericParse
r</tt> also allows to parse XML-encoded HL7v2 messages.
</td></tr></tbody></table>
</div>
</div>
@@ -27400,12 +27401,12 @@ Then you don't need to create an instanc
<p>To use HL7 in your Camel routes you'll need to add a dependency on
<b>camel-hl7</b> listed above, which implements this data format. </p>
-<p>The HAPI library since Version 0.6 has been split into a <a shape="rect"
class="external-link"
href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base/1.2/"
rel="nofollow">base library</a> and several structure libraries, one for each
HL7v2 message version:</p>
+<p>The HAPI library since Version 0.6 has been 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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
rel="nofollow">v2.6 structures library</a></li></ul>
+<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="externa
l-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 <tt>camel-hl7</tt> only references the HAPI <a shape="rect"
class="external-link"
href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base/1.2/"
rel="nofollow">base library</a>. Applications are responsible for including
structure libraries themselves. For example, if a application works with HL7v2
message versions 2.4 and 2.5 then the following dependencies must be added:</p>
+<p>By default <tt>camel-hl7</tt> 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 a application works with HL7v2 message versions 2.4
and 2.5 then the following dependencies must be added:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
@@ -27413,16 +27414,18 @@ Then you don't need to create an instanc
<span class="code-tag"><groupId></span>ca.uhn.hapi<span
class="code-tag"></groupId></span>
<span class="code-tag"><artifactId></span>hapi-structures-v24<span
class="code-tag"></artifactId></span>
<span class="code-tag"><version></span>1.2<span
class="code-tag"></version></span>
+ <span class="code-tag"><span class="code-comment"><!-- use the same
version as your hapi-base version --></span></span>
<span class="code-tag"></dependency></span>
<span class="code-tag"><dependency></span>
<span class="code-tag"><groupId></span>ca.uhn.hapi<span
class="code-tag"></groupId></span>
<span class="code-tag"><artifactId></span>hapi-structures-v25<span
class="code-tag"></artifactId></span>
<span class="code-tag"><version></span>1.2<span
class="code-tag"></version></span>
+ <span class="code-tag"><span class="code-comment"><!-- use the same
version as your hapi-base version --></span></span>
<span class="code-tag"></dependency></span>
</pre>
</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/1.2/"
rel="nofollow">central Maven repository</a>. </p>
+<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" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
@@ -27434,9 +27437,84 @@ Then you don't need to create an instanc
</pre>
</div></div>
-<p>Note that the version number must match the version of the hapi-base
library that is transitively referenced by this component.</p>
-<h3><a shape="rect" name="BookInOnePage-Samples"></a>Samples</h3>
+<h3><a shape="rect"
name="BookInOnePage-Terserlanguage%28Camel2.11%29"></a>Terser language
(<b>Camel 2.11</b>)</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" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span> org.apache.camel.component.hl7.HL7.terser;
+...
+
+ <span class="code-comment">// extract patient ID from field QRD-8 in the
QRY_A19 message above and put into message header
+</span> from(<span class="code-quote">"direct:test1"</span>)
+ .setHeader(<span class="code-quote">"PATIENT_ID"</span>,terser(<span
class="code-quote">"QRD-8(0)-1"</span>))
+ .to(<span class="code-quote">"mock:test1"</span>);
+ <span class="code-comment">// <span class="code-keyword">continue</span>
processing <span class="code-keyword">if</span> extracted field equals a
message header
+</span> from(<span class="code-quote">"direct:test2"</span>)
+ .filter(terser(<span class="code-quote">"QRD-8(0)-1"</span>)
+ .isEqualTo(header(<span class="code-quote">"PATIENT_ID"</span>))
+ .to(<span class="code-quote">"mock:test2"</span>);
+
+</pre>
+</div></div>
+
+
+<h3><a shape="rect"
name="BookInOnePage-HL7Validationpredicate%28Camel2.11%29"></a>HL7 Validation
predicate (<b>Camel 2.11</b>)</h3>
+
+<p>Often it is preferable to parse a HL7v2 message and 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> in a separate step afterwards.</p>
+
+<p>Sample:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span>
org.apache.camel.component.hl7.HL7.messageConformsTo;
+<span class="code-keyword">import</span>
ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+ <span class="code-comment">// Use standard or define your own validation
rules
+</span> ValidationContext defaultContext = <span
class="code-keyword">new</span> DefaultValidation();
+
+ <span class="code-comment">// Throws PredicateValidationException <span
class="code-keyword">if</span> message does not validate
+</span> from(<span
class="code-quote">"direct:test1"</span>).validate(messageConformsTo(defaultContext)).to(<span
class="code-quote">"mock:test1"</span>);
+</pre>
+</div></div>
+
+
+<h3><a shape="rect"
name="BookInOnePage-HL7Acknowledgementexpression%28Camel2.11%29"></a>HL7
Acknowledgement expression (<b>Camel 2.11</b>)</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 <tt>ack</tt> expression lets us accomplish this very elegantly:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span>
org.apache.camel.component.hl7.HL7.messageConformsTo;
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span> org.apache.camel.component.hl7.HL7.ack;
+<span class="code-keyword">import</span>
ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+ <span class="code-comment">// Use standard or define your own validation
rules
+</span> ValidationContext defaultContext = <span
class="code-keyword">new</span> DefaultValidation();
+
+ from(<span class="code-quote">"direct:test1"</span>)
+ .onException(Exception.class)
+ .handled(<span class="code-keyword">true</span>)
+ .transform(ack()) <span class="code-comment">// auto-generates
negative ack because of exception in Exchange
+</span> .end()
+ .validate(messageConformsTo(defaultContext))
+ <span class="code-comment">// <span class="code-keyword">do</span>
something meaningful here
+</span> ...
+ <span class="code-comment">// acknowledgement
+</span> .transform(ack())
+</pre>
+</div></div>
+
+
+<h3><a shape="rect" name="BookInOnePage-MoreSamples"></a>More Samples</h3>
<p>In the following example we send a HL7 request to a HL7 listener and
retrieves a response. We use plain <tt>String</tt> types in this example:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-java"><span class="code-object">String</span> line1 = <span
class="code-quote">"MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4"</span>;
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/hl7.html
==============================================================================
--- websites/production/camel/content/hl7.html (original)
+++ websites/production/camel/content/hl7.html Fri Aug 24 15:19:56 2012
@@ -80,7 +80,7 @@
<p>The <b>hl7</b> component is used for working with the HL7 MLLP protocol and
<a shape="rect" class="external-link" href="http://www.hl7.org/"
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" type="square"><li>HL7 MLLP codec for <a shape="rect"
class="external-link" href="http://mina.apache.org/">Mina</a></li><li>Agnostic
data format using either plain String objects or HAPI HL7 model
objects.</li><li><a shape="rect" href="type-converter.html" title="Type
Converter">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat
using HAPI library</li><li>Even more ease-of-use as it's integrated well with
the <a shape="rect" href="mina.html" title="MINA">camel-mina</a>
component.</li></ul>
+<ul class="alternate" type="square"><li>HL7 MLLP codec for <a shape="rect"
class="external-link" href="http://mina.apache.org/">Mina</a></li><li>Agnostic
data format using either plain String objects or HAPI HL7 model
objects.</li><li><a shape="rect" href="type-converter.html" title="Type
Converter">Type Converter</a> from/to HAPI and String</li><li>HL7 DataFormat
using HAPI library</li><li>Even more ease-of-use as it's integrated well with
the <a shape="rect" href="mina.html" title="MINA">camel-mina</a> (<b>Camel
2.11</b>: <span class="error">[camel-mina2]</span> ) component.</li></ul>
<p>Maven users will need to add the following dependency to their
<tt>pom.xml</tt> for this component:</p>
@@ -98,7 +98,7 @@
<h3><a shape="rect" name="HL7-HL7MLLPprotocol"></a>HL7 MLLP protocol</h3>
<p>HL7 is often used with the HL7 MLLP protocol that is a text based TCP
socket based protocol. This component ships with a Mina Codec that conforms to
the MLLP protocol so you can easily expose a HL7 listener that accepts HL7
requests over the TCP transport. </p>
-<p>To expose a HL7 listener service we reuse the existing <a shape="rect"
href="mina.html" title="MINA">camel-mina</a> component where we just use the
<tt>HL7MLLPCodec</tt> as codec.</p>
+<p>To expose a HL7 listener service we reuse the existing mina/mina2 component
where we just use the <tt>HL7MLLPCodec</tt> as codec.</p>
<p>The HL7 MLLP codec has the following options:</p>
<div class="confluenceTableSmall"><div class="table-wrap">
@@ -111,9 +111,10 @@
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag"><endpoint id=<span
class="code-quote">"hl7listener"</span> uri=<span
class="code-quote">"mina:tcp://localhost:8888?sync=true&amp;codec=#hl7codec"</span>/></span>
+ <span class="code-tag"><span class="code-comment"><!-- Camel 2.11:
uri="mina2:tcp... --></span></span>
</pre>
</div></div>
-<p>Notice we configure it to use <a shape="rect" href="mina.html"
title="MINA">camel-mina</a> with TCP on the <tt>localhost</tt> on port
<tt>8888</tt>. We use <b>sync=true</b> to indicate that this listener is
synchronous and therefore will return a HL7 response to the caller. Then we
setup mina to use our HL7 codec with <b>codec=#hl7codec</b>. Notice that
<tt>hl7codec</tt> is just a Spring bean ID, so we could have named it
<tt>mygreatcodecforhl7</tt> or whatever. The codec is also set up in the Spring
XML file:</p>
+<p>Notice that we use TCP on <tt>localhost</tt> on port <tt>8888</tt>. We use
<b>sync=true</b> to indicate that this listener is synchronous and therefore
will return a HL7 response to the caller. Then we setup mina to use our HL7
codec with <b>codec=#hl7codec</b>. Notice that <tt>hl7codec</tt> is just a
Spring bean ID, so we could have named it <tt>mygreatcodecforhl7</tt> or
whatever. The codec is also set up in the Spring XML file:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag"><bean id=<span
class="code-quote">"hl7codec"</span> class=<span
class="code-quote">"org.apache.camel.component.hl7.HL7MLLPCodec"</span>></span>
@@ -247,7 +248,7 @@ Then you don't need to create an instanc
<h3><a shape="rect" name="HL7-Options"></a>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"> Option </th><th colspan="1" rowspan="1"
class="confluenceTh"> Default </th><th colspan="1" rowspan="1"
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"> validate </td><td colspan="1" rowspan="1"
class="confluenceTd"> true </td><td colspan="1" rowspan="1"
class="confluenceTd"> Whether the HAPI Parser should validate.
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>parser</tt>
</td><td colspan="1" rowspan="1" class="confluenceTd">
<tt>ca.uhn.hl7v2.parser.PipeParser</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> <b>Camel 2.11:</b> To use a custom parser. Must be of
type <tt>ca.uhn.hl7v2.parser.Parser</tt>. </td></tr></tbody></table>
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"> Option </th><th colspan="1" rowspan="1"
class="confluenceTh"> Default </th><th colspan="1" rowspan="1"
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"> <tt>validate</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> true </td><td colspan="1" rowspan="1"
class="confluenceTd"> Whether the HAPI Parser should validate using the default
validation rules. <b>Camel 2.11:</b> better use the <tt>parser</tt> option and
initialize the parser with the desired HAPI <tt>ValidationContext</tt>
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>parser</tt>
</td><td colspan="1" rowspan="1" class="confluenceTd">
<tt>ca.uhn.hl7v2.parser.GenericParser</tt> </td><td colspan="1" rowspan="1"
class="confluenceTd"> <b>Camel 2.11:</b> To use a custom parser. Must be of
type <tt>ca.uhn.hl7v2.parser.Parser</tt>. Note that <tt>GenericParse
r</tt> also allows to parse XML-encoded HL7v2 messages.
</td></tr></tbody></table>
</div>
</div>
@@ -256,12 +257,12 @@ Then you don't need to create an instanc
<p>To use HL7 in your Camel routes you'll need to add a dependency on
<b>camel-hl7</b> listed above, which implements this data format. </p>
-<p>The HAPI library since Version 0.6 has been split into a <a shape="rect"
class="external-link"
href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base/1.2/"
rel="nofollow">base library</a> and several structure libraries, one for each
HL7v2 message version:</p>
+<p>The HAPI library since Version 0.6 has been 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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
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/1.2/"
rel="nofollow">v2.6 structures library</a></li></ul>
+<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="externa
l-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 <tt>camel-hl7</tt> only references the HAPI <a shape="rect"
class="external-link"
href="http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base/1.2/"
rel="nofollow">base library</a>. Applications are responsible for including
structure libraries themselves. For example, if a application works with HL7v2
message versions 2.4 and 2.5 then the following dependencies must be added:</p>
+<p>By default <tt>camel-hl7</tt> 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 a application works with HL7v2 message versions 2.4
and 2.5 then the following dependencies must be added:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
@@ -269,16 +270,18 @@ Then you don't need to create an instanc
<span class="code-tag"><groupId></span>ca.uhn.hapi<span
class="code-tag"></groupId></span>
<span class="code-tag"><artifactId></span>hapi-structures-v24<span
class="code-tag"></artifactId></span>
<span class="code-tag"><version></span>1.2<span
class="code-tag"></version></span>
+ <span class="code-tag"><span class="code-comment"><!-- use the same
version as your hapi-base version --></span></span>
<span class="code-tag"></dependency></span>
<span class="code-tag"><dependency></span>
<span class="code-tag"><groupId></span>ca.uhn.hapi<span
class="code-tag"></groupId></span>
<span class="code-tag"><artifactId></span>hapi-structures-v25<span
class="code-tag"></artifactId></span>
<span class="code-tag"><version></span>1.2<span
class="code-tag"></version></span>
+ <span class="code-tag"><span class="code-comment"><!-- use the same
version as your hapi-base version --></span></span>
<span class="code-tag"></dependency></span>
</pre>
</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/1.2/"
rel="nofollow">central Maven repository</a>. </p>
+<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" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
@@ -290,9 +293,84 @@ Then you don't need to create an instanc
</pre>
</div></div>
-<p>Note that the version number must match the version of the hapi-base
library that is transitively referenced by this component.</p>
-<h3><a shape="rect" name="HL7-Samples"></a>Samples</h3>
+<h3><a shape="rect" name="HL7-Terserlanguage%28Camel2.11%29"></a>Terser
language (<b>Camel 2.11</b>)</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" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span> org.apache.camel.component.hl7.HL7.terser;
+...
+
+ <span class="code-comment">// extract patient ID from field QRD-8 in the
QRY_A19 message above and put into message header
+</span> from(<span class="code-quote">"direct:test1"</span>)
+ .setHeader(<span class="code-quote">"PATIENT_ID"</span>,terser(<span
class="code-quote">"QRD-8(0)-1"</span>))
+ .to(<span class="code-quote">"mock:test1"</span>);
+ <span class="code-comment">// <span class="code-keyword">continue</span>
processing <span class="code-keyword">if</span> extracted field equals a
message header
+</span> from(<span class="code-quote">"direct:test2"</span>)
+ .filter(terser(<span class="code-quote">"QRD-8(0)-1"</span>)
+ .isEqualTo(header(<span class="code-quote">"PATIENT_ID"</span>))
+ .to(<span class="code-quote">"mock:test2"</span>);
+
+</pre>
+</div></div>
+
+
+<h3><a shape="rect" name="HL7-HL7Validationpredicate%28Camel2.11%29"></a>HL7
Validation predicate (<b>Camel 2.11</b>)</h3>
+
+<p>Often it is preferable to parse a HL7v2 message and 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> in a separate step afterwards.</p>
+
+<p>Sample:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span>
org.apache.camel.component.hl7.HL7.messageConformsTo;
+<span class="code-keyword">import</span>
ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+ <span class="code-comment">// Use standard or define your own validation
rules
+</span> ValidationContext defaultContext = <span
class="code-keyword">new</span> DefaultValidation();
+
+ <span class="code-comment">// Throws PredicateValidationException <span
class="code-keyword">if</span> message does not validate
+</span> from(<span
class="code-quote">"direct:test1"</span>).validate(messageConformsTo(defaultContext)).to(<span
class="code-quote">"mock:test1"</span>);
+</pre>
+</div></div>
+
+
+<h3><a shape="rect"
name="HL7-HL7Acknowledgementexpression%28Camel2.11%29"></a>HL7 Acknowledgement
expression (<b>Camel 2.11</b>)</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 <tt>ack</tt> expression lets us accomplish this very elegantly:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span>
org.apache.camel.component.hl7.HL7.messageConformsTo;
+<span class="code-keyword">import</span> <span
class="code-keyword">static</span> org.apache.camel.component.hl7.HL7.ack;
+<span class="code-keyword">import</span>
ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+ <span class="code-comment">// Use standard or define your own validation
rules
+</span> ValidationContext defaultContext = <span
class="code-keyword">new</span> DefaultValidation();
+
+ from(<span class="code-quote">"direct:test1"</span>)
+ .onException(Exception.class)
+ .handled(<span class="code-keyword">true</span>)
+ .transform(ack()) <span class="code-comment">// auto-generates
negative ack because of exception in Exchange
+</span> .end()
+ .validate(messageConformsTo(defaultContext))
+ <span class="code-comment">// <span class="code-keyword">do</span>
something meaningful here
+</span> ...
+ <span class="code-comment">// acknowledgement
+</span> .transform(ack())
+</pre>
+</div></div>
+
+
+<h3><a shape="rect" name="HL7-MoreSamples"></a>More Samples</h3>
<p>In the following example we send a HL7 request to a HL7 listener and
retrieves a response. We use plain <tt>String</tt> types in this example:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-java"><span class="code-object">String</span> line1 = <span
class="code-quote">"MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4"</span>;