Info |
---|
During the Iguana Server migration, you might need to manually resubmit queued message from the old Iguana into the new Iguana. There are two ways to achieve it. |
https://www.youtube.com/embed/MCZj1K4du3U
Iguana Log Export
Navigate to Iguana Logs
Configure the following Search Criteria:
Channel
Type=Message
Hide Deleted
Time Range (If know the queued message time range)
Choose on Export
Choose A CSV file
Click on Export button to generate CSV
Open CSV in Excel and Delete None “Message“ type logs (such as “Ignored Data Msg“)
Back Iguana Logs with the same Step 2 Search Criteria
Click on “Last Processed Message” link
Scroll up/down to find the “Last Processed Message“ message that has “PROCESSED“ tag and click on it
Click on “Show me a direct link to this entry“ to capture the message refid
Use refid to find the last processed message in CSV file
Find refid in CSV MessageId column and delete all the earlier processed messages include the “Last Processed Message“
The remaining messages in CSV are queued messages
...
Lua Code
Code Block | ||
---|---|---|
| ||
-- Compare two msgIds and see if id1 > id2 local function compareMsgIds(id1, id2) local isBigger = false local id1List = id1:split("-") local id2List = id2:split("-") if id1List[1] > id2List[1] then isBigger = true elseif id1List[1] == id2List[1] then if tonumber(id1List[2]) >= tonumber(id2List[2]) then isBigger = true end end return isBigger end -- The main function is the first function called from Iguana. function main() -- 1) Define Queued Channel Name and Message Count local CHANNEL_NAME = '01-FileHL7 to Database Socket4' local QUEUED_COUNT = 37 local LOG_COUNT = 20 --Adjust QUERY COUNT if not all queued messages have been queried -- 2) Query Queued and Ignored Data Msg Messages local LogResults = net.http.post{ url = 'http://localhost:6543/api_query', auth = {username = 'admin',password = 'password'}, parameters = { source= CHANNEL_NAME, limit = LOG_COUNT, type="messages", deleted = 'false', reverse = true }, live=true } local logXML = xml.parse{data=LogResults}.export -- 3) Filter and validate only Queued Messages local filteredLogMsgs = {} for i= 1, logXML:childCount("message") do if logXML:child("message", i).type:nodeValue() == "Message" then table.insert(filteredLogMsgs, logXML:child("message", i)) end end -- 4) Get last Processed Message LogResults = net.http.post{ url = 'http://localhost:6543/log_browse_get_dequeue_position', auth = {username = 'admin',password = 'password'}, body = "Source="..CHANNEL_NAME, live=true } logXML = json.parse{data=LogResults} local processedMsg = logXML[CHANNEL_NAME] local msgId = processedMsg.Date:gsub("/", "").."-"..processedMsg.Position trace(msgId) -- 5) Filter out processed Message local queuedMsgs = {} for i=1, #filteredLogMsgs do if compareMsgIds(msgId, filteredLogMsgs[i].message_id:nodeValue()) == msgId then break else table.insert(queuedMsgs,filteredLogMsgs[i].data) end end -- 6) Validate queued messages trace(queuedMsgs) if #queuedMsgs ~= QUEUED_COUNT then error("Not all queued messages have been queried, increase LOG_COUNT") end trace(queuedMsgs) end |