Hi,
Currently, i'm using API libs to synchronize information between the two
systems. Recently, I had some difficulty in using the aplication handlers
(from HAPI) to listen for unsolicited messages.
Use case:
We need to syncronize some information between two clinical information
systems: from system A to B. For that, system A send OMP_O09 message to
system B, receiving the corresponding receipt of communication and
subscribe ORP_O10 message (comming from system B) as a application
acknowledgement using Application handlers.
Problem:
- OMP_O09 message is sent successfully from A to B, and SimpleServer
(listener) is started on A;
- Comunication acknowledgement (ACK) is returned in response;
- System B sent Applicational acknowledgement (ORP_O10) to A with some
information about the success of the operation performed;
- SimpleServer (listener) receive ORP_O10 but considers it as "Unexpected
Message Received";
[LOG]
(HapiLogImpl.java:78) - Accepted connection from 192.168.4.202
(HapiLogImpl.java:33) - ACK ID: MSG305
(HapiLogImpl.java:78) - End of input stream reached.
(HapiLogImpl.java:78) - Closing connection (no more messages available).
(HapiLogImpl.java:33) - ACK ID: MSG305
(HapiLogImpl.java:78) - Unexpected Message Received:
MSH|^~\&|SAM|1030101|PEM|SPMS|20120820173323.644+0100||ORP^O10|be5c9b09-e93b-
465e-aaeb-d533b6b4b6ce|P|2.5
MSA|AA|MSG305|Success|||
[/LOG]
After some code analysis we detect that in processMessage (method of
Receiver class) is invoked conn.findRecipient(ackID) method that verify if
ackId is in receipts table. As ACK already been processed, ackID has been
removed from receipts table, this causes a null MessageReceipt. So the
message is not processed.
[CODE FROM RECEIVER CLASS]
protected void processMessage(String message) {
String ackID = conn.getParser().getAckID(message);
if (ackID == null) {
Grunt g = new Grunt(conn, message);
g.start();
}
else {
MessageReceipt mr = conn.findRecipient(ackID);
if (mr == null) {
log.info( "Unexpected Message Received: " + message );
}
else {
mr.setMessage(message);
}
}
}
[/CODE FROM RECEIVER CLASS]
It seems that sendAndReceive method from Initiator class is ONLY SUITEABLE
for send a mensage and receive the corresponding comunication ACK!
I wonder if anyone can help me with this issue. On one hand I wonder if
this is really a problem that has not yet been spoken. On the other hand,
if there are other solutions that you seem better suited for this situation.
Cheers,
Paulo Ferreira.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel