Configure the Channel Filter

Configure Filter Settings using the Filter Tab.

When you create a channel, you can (optionally) activate that a Filter scripting component that processes messages before they are transmitted to the destination component. Use the filter script to process messages according to your business requirements, usually by transforming the messages or filtering out messages you wish to ignore.

From here you can Enable the filter, choose when to Apply the filter, choose to Log a Post filter Message, and choose the Filter type.

  • Click the Edit Channel button
  • Check the Use Filter checkbox
  • Enter your settings and click Save Changes

Use filter

  •  Check Use filter to activate the filter component

Apply filter

  •  Choose when to apply the filter from the drop-down list:
  • Select before writing the message to the queue to apply the filter before the processed message is logged
    Note: Only the processed messages are logged unless you enable Log pre-filter message (next option)
  • Select after reading the message from the queue to apply the filter after the original message is logged
    Note: Only the unprocessed messages are logged unless you enable Log post-filter message (next option)

Log pre/post-filter message

  •  If you chose Apply Filter before writing the message to the queue the Log pre-filter message option will be shown
  • If you chose Apply Filter after reading the message from the queue the Log post-filter message option will be shown
  • Check the checkbox to enable pre/post-filter message logging

Filter type

  •  Check Translator to use a filter script
  • Check Legacy to use a legacy VMD filter

Legacy Settings: [top]

If you selected the Legacy filter option, the following settings will appear:

Full filter VMD path

  • Enter the location of the VMD file that will be used to perform filtering

    Note: You can include an environment variable in the file path, by use ${<var-name>} syntax. For example, the file path ${iguana_dir}myfile.vmd uses the builtin iguana_dir environment variable to include the Iguana working directory.

Error handling

  • From the Error handling list box, select how errors should affect the behaviour of this channel:
    • Select Skip message to log the errors and skip the current message
    • Select Stop channel to log the errors and stop the channel

Ignored messages

  • Enter the name of a message that is to be ignored by this channel and click Add Ignored Message
    To enter multiple messages names place each one on a separate line then click Add Ignored Message
  • The message names specified here must match message names defined in the filter VMD file
  • To remove a message from the ignore list click the Remove button next to it

Transformation mode

  • Select the appropriate mode from the listbox:
    Transformation mode Definition
    No transformation Messages are filtered without being transformed.
    Scripted transformation Use scripted transformation to transform the messages.
    Graphical transformation Use graphical transformation to transform the messages.
    XML to HL7 Transform the message from XML format to HL7 format.
    HL7 to XML Transform the message from HL7 format to XML format.
  • If you selected Scripted transformation, a Configuration name field appears that allows you to the configuration name that is defined in your VMD file. If you have not created any configuration names for your VMD file, use default.
  • If you selected Graphical transformation, two additional fields appear:
    • In the Incoming configuration name field, type the name of the incoming configuration.
    • In the Outgoing configuration name field, type the name of the outgoing configuration.

    Both of these configuration names must be defined in the VMD file specified in the Full filter VMD path field.

Note: If you do not specify a transformation mode or messages to ignore, you can still use a filter. This is useful if you want to use the filter VMD file to run Python scripts.

Understanding Apply Filter [top]

When you configure a filter for a channel, you can specify that the filter is to be applied before or after the message is queued in the Iguana log:

  • If the filter is applied before writing the message to the queue, only the transformed message is added to the log. Messages that are ignored are not logged.
  • If the filter is applied after reading the message from the queue, all messages are logged right away. Messages that are ignored are included in the log, but are skipped.

For best results, applying the filter after reading the message from the queue is recommended. Here are the reasons why this approach is best:

  • If a filter is applied after the original message is logged, any future log entries for this message can be related to the original message. This is helpful when you are debugging your channel.
  • Because the original message is logged, it can be resubmitted to the filter and destination if necessary.
  • If an error occurs during filtering, and the filter is configured to stop the channel when an error occurs, the message that caused the error will still be in the message queue. If the filter is applied before the message, the original message is lost.
  • If the filter is performing a transformation, and the transformation script in the VMD file takes a long time to execute, other messages can still be added to the message queue. If the filter is applied before the message, the transformation must be completed before other messages can be added to the message queue.

However, applying the filter before writing the message to the queue has its advantages:

  • If an incoming message contains confidential data, the message can be ignored, which ensures that it does not appear in the Iguana logs. You can also transform a message to eliminate the confidential data before the message is logged.
  • If a message is too large to be logged, a transformation script can eliminate unneeded information and make the message smaller.
  • If your incoming messages are in XML format, and you only want HL7 messages to appear in your logs or in your message queue, you can apply the filter’s transformation before logging the message.

Note: If your source component is From Channel, you cannot apply the filter before logging the message, since your channel is receiving messages that have been queued by another channel. To filter messages before logging, define a message filter in the channel that is sending you the messages. If your destination component is To Channel, you cannot apply the filter after logging the message, as the destination channel is responsible for removing messages from the message queue. If you want to transform messages after they are logged, you can use the destination channel to do this.

 

Leave a Reply