CMDHL7 Sender
CMDHL7 Sender
SYNOPSIS
java -jar CMDHL7Sender_v0.7 [OPTION]...
DESCRIPTION
Read a file containing one or more HL7 v2.x Delimited messages,
connect to a specified HL7 MLLP Listener, send each message to
the listener and receive an acknowledgement.
-h HOST, --host=HOST
TCP Host to which to connect
-p PORT, --port=PORT
TCP Port to which to connect
-f FILE, --file=FILE
File system path to the file which contains HL7 v2.x
Delimited messages to be sent
-n NUMBER, --number=NUMBER
[Optional] maximum number of messages from a multi-
message file, which to send to the remote listener
-d DELIMITERS, --delimiters=DELIMITERS
[Optional] delimiter string separating HL7 messages in
the multi-message file - defaults to the string \r\r\n
-t TIMEOUTMIILIS, --timeout=TIMEOUTMIILIS
[Optional] number of milliseconds to wait for HL7
acknowledgement before concluding that it will not come
and emitting an error message
-w WAITMILLIS, --wait=WAITMILLIS
[Optional] number of milliseconds to wait between
sending successive messages from a multi-message file.
This switch can be used to throttle the sender. If not
specified the sender sends as fast as it can.
-c CONTROLIDPREFIX, --controlIdPrefix=CONTROLIDPREFIX
[Optional] string to prefix a generated Message Control
Id (MSH-10) which will consist of this string followed
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.
-a SENDINGAPPLICATION, --sendingApplication=SENDINGAPPLICATION
[Optional] string to use as MSH-3-1, Sending
Application.
If absent, the MSH-3-1 from the message read from the
file will be retained as is.
-b SENDINGFACILITY, --sendingFacility=SENDINGFACILITY
1
[Optional] string to use as MSH-4-1, Sending Facility.
If absent, the MSH-4-1 from the message read from the
file will be retained as is.
-x RECEIVINGAPPLICATION, --
receivingApplication=RECEIVINGAPPLICATION
[Optional] string to use as MSH-5-1, Receiving
Application.
If absent, the MSH-5-1 from the message read from the
file will be retained as is.
-y RECEIVINGFACILITY, --receivingFacility=RECEIVINGFACILITY
[Optional] string to use as MSH-6-1, Receiving
Facility.
If absent, the MSH-6-1 from the message read from the
file will be retained as is.
-r REPEATCOUNT, --repeatCount=REPEATCOUNT
[Optional] How many times to repeat the process of
sending the NUMBER of messages specififed by -n
-z, --performanceMeasurement
[Optional] Whether to enable performance measurement
instrumentation. Replaces MSH-7 with
System.currentTimeMillis. Resets -w to 0.
-i, --ignoreACKs
[Optional] Whether to force MSH-15 and MSH-16 to NE to
tell the remote to not send ACKs and to force
implementation to not wait for ACKs.
-q, --quiet
[Optional] Don't emit performance statistics at end of
run.
The sender supports HL7 v2.1 through 2.6, including 2.3.1 and
2.5.1, as implemented in HAPI 1.0.1 libraries.
2
The sender can optionally generate MSH-10, Message Control Id,
for each outgoing message, overriding MSH-10 form the message
in the file. The generated message control id consists of the
specified prefix and the message number form the file - for
example HOSA_0000001, where HOSA is the specified prefix,
0000001 is the number of the message in the file (first
message).
C:\jdk1.6.0_20\bin\java -
Djava.util.logging.config.file=logging.properties -jar
CMDHL7...
EXAMPLES
java -jar CMDHL7Sender_v0.7.jar -h localhost -p 22100 -f c:\hl7
\adt\sources\ADT_A03_output_5099.hl7 -d \r\r\n -n 10 -t 50000 -
w 1000 -c HOSA -a SystemA -b HosA -x SystemX -y HosX
3
_output_5099.hl7
Messages are delimited by \r\r\n (-d \r\r\n)
Send 10 messages (-n 10)
Wait up to 50 seconds for the ACK (-t 50000)
Wait 1 second between each successive message (-w 1000)
Generate MSH-10 with the prefix of HOSA
Substitute SystemA HosA for MSH-3-1 and MSH-4-1
(sending application and sending facility)
Substitute SystemX HosX for MSH-5-1 and MSH-6-1
(receiving application and receiving facility)
4
Market^England -
PV1|1
|I||I|||GOO^Goodlace^Andrew^^^^^^^^^^MAIN|||EMR||||||||
|V20080908014345^^^^VISIT|||||||||||||||||DISH DIS
P|disch loc|||||||20080908014345|2008091012529
29/12/2010 8:54:45 AM ca.uhn.log.HapiLogImpl info
MSA|AA|HOSA_1_1293584085019ssage: MSH|^~
\&|SystemX|HosX|SystemA|HosA|20101229085445.05+0800
||ACK|3|P|2.3.1
29/12/2010 8:54:45 AM ca.uhn.log.HapiLogImpl info
MSA|AA|HOSA_1_1293584085019|SystemA|HosA|
20101229085445.05+0800||ACK|3|P|2.3.1
29/12/2010 8:54:45 AM ca.uhn.log.HapiLogImpl info
INFO: Instantiating msg of class
ca.uhn.hl7v2.model.v231.message.ACK
29/12/2010 8:54:45 AM au.id.czapski.hl7.CMDHL7Sender
main
INFO: Received response:
MSH|^~\&|SystemX|HosX|SystemA|HosA|20101229085445.05+
0800||ACK|3|P|2.3.1
MSA|AA|HOSA_1_1293584085019
...
C:\jdk1.6.0_20\bin\java -
Djava.util.logging.config.file=logging_with_debug.properties -
jar CMDHL7Sender_v0.7.jar -d \r\r\n -f c:\hl7\adt\sources
\ADT_A01_output_50000.hl7 -h localhost -p 22100 -t 60000 -a
SNDS -b APPS -x GWYR -y APGR -c A -n 1 -r 1
C:\jdk1.6.0_20\bin\java -
Djava.util.logging.config.file=logging.properties -jar
CMDHL7Sender_v0.7.jar -d \r\r\n -f c:\hl7\adt\sources\ADT_A01
_output_50000.hl7 -h localhost -p 22100 -t 60000 -a SNDS -b
APPS -x GWYR -y APGR -c A -n 1 -r 1
AUTHOR
Michael Czapski.
michael . w . czapski at gmail . com
KNOWN ISSUES
If the CMDHL7Sender does not like the ACK it will go into a
tailspin, out of which the only way out is to kill the process
(Control C in the console window will do that). It will not
like the ack if the ack MSA-2 (Message Control Id) is not
identical to the MSH-10 of the message it is acknowledging, for
example.
5
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 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
CMDHL7Proxy, CMDHL7Listener