Urgent.News

What's breaking now, across thousands of outlets.

Tech

What a test HL7 v2 sender has to get right

Sending an HL7 v2 message is easy. Open a TCP socket, wrap the message in MLLP framing, write it, and read whatever comes back. You can do it in twenty lines of code, and there are plenty of tools that do. Knowing whether the message actually arrived, and what to do when it didn't, is the hard part. I found that out while building HL7 Sender ,an open-source desktop app and CLI for testing HL7 v2…

Sending an HL7 v2 message involves a few key steps. First, establish a TCP socket connection and wrap the message in MLLP framing. Then, write the message and read the acknowledgment that comes back. The challenge lies in ensuring the message is delivered successfully, not just that it was received. To do this, test engineer learned that an ACK timeout needs to be a total deadline, not a read timeout.

Set the socket timeout based on the remaining time, not a fixed value like 30 seconds. An ACK is only valid if the MSA-2 code matches the MSH-10 of the sent message. If it doesn't match, it belongs to a different message, which could lead to a message being lost. The test tool must handle ambiguous responses by closing the connection after a timeout or mismatch.

HL7 v2 has two acknowledgment modes, and their codes look like pairs. However, the commit codes (CR and CE) have different implications. CR means the receiver won't take the message, while CE means there's a different issue that might be resolved with a retry. Enhanced mode requires two steps: a commit ACK on the same connection and an application ACK on a separate connection.

If the sender marks the message as done on the CA, a later application error won't be recorded. A crash during the send process can result in message loss or reordering. To prevent this, HL7 Sender writes the state before performing network I/O, using SQLite with WAL mode and synchronous=FULL.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I searched Google Hotels for a city that does not exist. It found five hotels.

I typed "hotels in Qwzxvbnmplk" into my Google Hotels scraper to watch it fail. It did not fail. It came back with five hotels near San Antonio, Texas, each with a price, a rating and a map position.

  • Author tested non-existent city searches on Google Hotels
  • Google provided five hotel results near San Antonio, Texas
  • Fix implemented but caused issues with real city, Prague

We stopped trusting exchange-reported volume and measured it ourselves

Every crypto price you have ever looked at is a summary of trades that happened somewhere. Most sites that show you that price do not look at the trades.

  • Coinmico measures exchange-reported volume itself
  • Collects data from 58 exchanges and 21 chains
  • Computes venue count and confidence score every two seconds

More from Friday 9 October →