senaranya / HL7

PHP library for Parsing, Generation and Sending HL7 v2 messages
MIT License
183 stars 86 forks source link

Receive multiple answers #88

Closed dtamajon closed 1 year ago

dtamajon commented 2 years ago

Hi,

We are dealing with a HL7 connection where after we send a message the server returns multiple messages, but the library only process the first one. Is it there any option to wait until the server has sent all the messages?

Thank you!!

senaranya commented 2 years ago

Hi,

Unfortunately there is none. The message sender waits only for the ACK/NACK and is not designed to be used as full-blown message listener. Even if you increase the timeout, it expects only a single message and the multiple messages the server sends will be considered as one large message, which isn't what you'd expect.

You can either create a subclass from Connection class, and override the send() method to your needs, or use a separate message listener (which is out of scope for this library)