The algorithm is easy. We create a database table “continuation” which is used to store the messages that need continuation data.
This will have a simple structure:
|ContinuationId (key)||Unique code identifying the continuation number. Needs to be large enough to store the keys, say 100 characters|
|Message||The raw HL7 message. Should be about 100k in size depending on the largest message size.|
When we get a message that needs us to wait for a continuation part we insert it into this table using the Continuation Pointer value as the key value for the ContinuationId.
Then when we get the remainder message we can recall that data from the table and parse it and combine the data together with the original message. Fortunately Iguana has no trouble coping with messages larger than 64k in length!
For simplicity we only show how to process the continuation message, the concatenated message will need further processing/saving etc (code for this is not included).