Custom ACKs

Failover Solution

One interesting scenario we came across with a client was this one they had third party EHR systems sending messages which could sometimes be incorrect. They would want to send a negative acknowledgment instead of forwarding the messages to their pharmacy system.

So the algorithm to follow was:

  1. Get the message.
  2. Send it to a web service to validate and in some case modify the message.
  3. If it was bad send back a negative ACK, this would be rendered inside the EHR systems allowing the end user or IT team to resolve the problem.
  4. If good, send it to the Pharmacy System, get the ACK and then send that back to the EHR system (since it could be negative).

The problem is what to do when the Pharmacy system is down. Obviously the NACK mechanism cannot be maintained but data still needs to flow.

So here’s a failover solution. The solution works by having one channel set up with LLP–>To Channel. The above script goes into the LLP Translator script. A second channel is set up with LLP listener –> LLP client which just acts as a queue when the pharmacy system is not able to receive the messages.


function main(Data)
   local Success = pcall(SendMessage, Data)
   if not Success then

function SendMessage(Data)
   -- optionally validate data here - if message is bad send NACK
   local C = llp.connect{host='localhost', port=5145, live=true, timeout=1}
   local A = C:recv()

function SendMessageToQueue(Data)
   local C = llp.connect{host='localhost', port=5362, live=true}
   local A = C:recv()

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.