CMDHL7Listener
CMDHL7Listener
SYNOPSIS
java -jar CMDHL7Listener_v0.7 [OPTION]...
DESCRIPTION
Listen, on the specified TCP Port, for incoming HL7 v2.x
Delimited messages, generating and sending generic HL7 v2.x
acknowledgements for each. Optionally, with the -s option,
store incoming messages as files in the specified file system
directory, with file names derived from message content.
-p PORT, --port=PORT
TCP Port on which to listen for connections
-s DIRECTORY, --store=DIRECTORY
[Optional] File system directory in which to store
received messages as files with the file name pattern
derived from Message Control Id [MSH-10], Message Type
[MSH-9-1], Trigger Event [MSH-9-2] and current time in
milliseconds. An example would be 000000_CTLID_
2008091012529_ADT_A03_1293578341691.hl7 where 000000
_CTLID_2008091012529 is the content of the MSH-10, ADT
is the content of the MSH-9-1, A03 is the content of
the MSH-9-2 and 1293578341691 is the number of
milliseconds since the epoch as given by Java's
System.currentTimeMillis().
-a SENDINGAPPLICATION, --sendingApplication=SENDINGAPPLICATION
[Optional] string to use as MSH-3-1, Sending
Application.
If absent, the MSH-5-1 from the message will be used.
-b SENDINGFACILITY, --sendingFacility=SENDINGFACILITY
[Optional] string to use as MSH-4-1, Sending Facility.
If absent, the MSH-6-1 from the message will be used.
-x RECEIVINGAPPLICATION, --
receivingApplication=RECEIVINGAPPLICATION
[Optional] string to use as MSH-5-1, Receiving
Application.
If absent, the MSH-3-1 from the message will be used.
-y RECEIVINGFACILITY, --receivingFacility=RECEIVINGFACILITY
[Optional] string to use as MSH-6-1, Receiving
Facility.
If absent, the MSH-4-1 from the message will be used.
-g, --gluttonStoreAsXML
[Optional] Store received HL7 v2 messages in XML
format. If -s/--storePath is not provided this switch
has no effect.
-c CONTROLIDPREFIX, --controlIdPrefix=CONTROLIDPREFIX
[Optional] string to prefix a generated Message Control
Id (MSH-10) which will consist of this string followed
1
by the underscore, followed by the sequence number of
the message read from the multi-message file. This will
replace the MSH-10 in the message read from the file.
If absent, the MSH-10 from the message read from the
file will be retained as is.
-z, --performanceMeasurement
[Optional] Whether to enable performance measurement
instrucmentation and statistics collection.
If -c/--controlIdPrefix is not provided this switch has
no effect.
It is assumed that the value provided by -c to the
listener is the same as that provided to the sender.
-f NUMBER, --fromSequece=NUMBER
[Optional] Specifies the MSH-10 Sequence Number part
from which to start accumulating run statistics. If -z
is not specified this switch has no effect. If -c is
not specified this switch has no effect.
-t NUMBER, --toSequece=NUMBER
[Optional] Specifies the MSH-10 Sequence Number part at
which to stop collecting statistics and to emit them to
stdout. If -c is not specified this switch has no
effect.
The listener supports HL7 v2.1 through 2.6, including 2.3.1 and
2.5.1, as implemented in HAPI 1.0.1 libraries. It generates
acknowledgements to match the version of the message and swaps
MSH-3, MSH-4 and MSH-5, MSH-6 from the original message for the
Acknowledgement.
C:\jdk1.6.0_20\bin\java -
Djava.util.logging.config.file=logging.properties -jar
CMDHL7...
EXAMPLES
java -jar CMDHL7Listener_v0.7.jar --port=22100 --store=.\files
2
the current working directory
29/12/2010 7:19:01 AM
au.id.czapski.hl7.SimpleACKApplication processMessage
INFO: Sending Applicaiton: SystemA
29/12/2010 7:19:01 AM
au.id.czapski.hl7.SimpleACKApplication processMessage
INFO: FileName: .\files\000000_CTLID_2008091012529
_ADT_A03_1293578341691.hl7
29/12/2010 7:19:01 AM ca.uhn.log.HapiLogImpl info
INFO: hapi.home is set to C:\tools\CMDHL7\.
29/12/2010 7:19:01 AM
3
au.id.czapski.hl7.SimpleACKApplication processMessage
INFO: Sending ACK:
MSH|^~\&|PI|MDM|SystemA|HosA|20101229071901.753+0800
||ACK|1|P|2.3.1
MSA|AA|000000_CTLID_2008091012529
AUTHOR
Michael Czapski.
michael . w . czapski at gmail . com
KNOWN ISSUES
There is no way to tell the listener to stop. I run this from a
command window and use Control C to stop it.
The code does not validate supposed HL7 v2.x delimited messages
for correctness. For example a message with invalid TS
(timestamp) data will be happily processed. I deliberately
disabled HAPI's validation to allow this.
I never tested this code with JDK other then JDK 1.6.0_20.
Since most of the good stuff comes from the HAPI 1.0.1 I expect
this code to work on any version of Java which HAPI 1.0.1
supports (last time I looked it was JDK 1.4 and up, though
one's experience may vary).
REPORTING BUGS
This is a rough developer tool - I am unlikely to maintain it
or have the time to fix bugs - besides, most of the good stuff
comes from the HAPI distribution and I don't look after bugs in
that library (if any - I assume that there are none)
COPYRIGHT
March, 2011
SEE ALSO
4
CMDHL7Proxy, CMDHL7Sender