When working on the HA solutions discussed in my HA blog entry I realized that it will be difficult to work out whether messages are delivered in order, as was required, and whether any are missing. I got over the issue by ensuring that my test data was prepared in such a way that messages in each test file had increasing, contiguous sequence numbers embedded in the message. For HL7 v2, which is the messaging standard with which I dealt, I used MSH-10, Message Control ID field. I wrote processed messages and acknowledgments to files whose names embedded MSH-10 Message Control Id, with the sequence number, so breaks in sequence and out of order messages could be readily detected.
With multiple message files containing between 1 and 50,000 messages, adding a sequence number to each message by hand was clearly out of the question.
I put the GlassFish ESB to use. I constructed a file-to-file BPEL module project to read each test file and to prepend a sequence number to each message’s MSH-10 field. The only snag was how to get a sequence number that would start at 0 and increase by 1 for each message, such that each BPEL process instance would get the next sequence, and that messages would be written to the output file in order.
This note discusses how I went about accomplishing the task.
The complete note, GFESBv22_EphemeralSequenceGenerator_v184.108.40.206.pdf, is to be found at: http://blogs.czapski.id.au/wp-content/uploads/2010/03/GFESBv22_EphemeralSequenceGenerator_v220.127.116.11.pdf