Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleHow to structure filtering rules in filters.lua

The following sample filtering rules are intended to be a base for you to adapt to your own requirements.

The filter.filterMessage() function does the following:

  • It filters out messages that match specified conditions

  • It logs a meaningful error in each case

  • It returns true if a message should be filtered (false if it is ok to continue processing)

Code Block
languagelua
-- This module contains sample filtering rules.  
-- Use your own filter conditions and error messages.

local filter ={}

function filter.filterMessage(msgIn, name) 
   if name ~= 'ADTA01' then
      iguana.logError('Unexpected message type.')
      return true
   elseif msgIn.MSH[3][1]:nodeValue():lower() == 'interfaceware' then      
      iguana.logError('Rejecting test message from iNTERFACEWARE.')
      return true
   elseif msgIn.PID[5][1][1]:nodeValue():lower() == 'addams' then      
      iguana.logError('No thing shall lurch or fester here!')
      return true
   end
   return false
end

return filter
Info

You can also use a Catchall Matching Rule in your VMD to identify multiple messages you to catch and filter out. See Creating a Catchall Matching Rule.