This topic contains 8 replies, has 2 voices, and was last updated by  steve.ela@macrohelix.com 2 weeks, 1 day ago.

Filtering 'from Channel' question

  • Hi folks!
    I have 2 inbound HL7 destination:Queue channels writing to the Queue, and 2 source:Queue channels that are reading from that same Queue. I added a JSON value to each message, and want to read it in the source:Queue filter. A version of the load balancing example on the outbound side.

    Problem is, I must be looking at the filters the wrong way. Doesn’t matter if I return True or False in the Filter, they all get rejected.

    Screen shot attached showing a False result, but message still filtered.

    I am coming from a different interface engine, so maybe i am just missing something obvious.

    Thanks!
    Steve

    Attachments:
    You must be logged in to view attached files.

    Steve Ela
    Macro Helix / McKesson
    Software Developer / Integration Lead

    Hi Steve,

    Anytime you use the return statement from the main script, that will end the processing of the message. So only use a return statement (you probably don’t need a True/False, just return), for the condition that will filter the message.

    Casey Trauer,
    Director, Client Education
    iNTERFACEWARE

    Hi Casey

    I made the change as follows

    function main(Data)
    MsgIn=json.parse{data=Data}
    trace(MsgIn.mhinfo.toQueue)
    trace(iguana.channelName())
    if MsgIn.mhinfo.toQueue ~= iguana.channelName() then
    return
    end
    end

    I checked the logs afterwards, and everything is still being filtered. I took the filter out and it processes everything as expected.

    Is it my comparison logic, or the types of each? The sample shows 2 strings that look identical.

    Steve Ela
    Macro Helix / McKesson
    Software Developer / Integration Lead

    Here is the sample

    trace(‘MH Database Writer 01′)
    channelName()->’MH Database Writer 01’ trace(‘MH Database Writer 01′)
    channelName()->’MH Database Writer 01’

    Steve Ela
    Macro Helix / McKesson
    Software Developer / Integration Lead

    Steve,

    Is there any other code logic in the Filter? Are you using queue.push to send it to the next component?

    Casey Trauer,
    Director, Client Education
    iNTERFACEWARE

    There is a toTranslator destination as well for processing the message.

    My goal, is for the channel to read the queue, decide if the message is meant for itself, and process or pass depending on that.

    A push would send to an outbound queue, not the translator, right?

    Steve Ela
    Macro Helix / McKesson
    Software Developer / Integration Lead

    Maybe I am still thinking in a Mirth context. The Filter would block or allow messages, which would then be processed by the Destination code.
    In Iguana, does all the code need to be in the Filter and ignore the destination?

    Steve Ela
    Macro Helix / McKesson
    Software Developer / Integration Lead

    In Iguana, the Filter component can be used for more than filtering messages. For example, you could do transformation logic there too. It’s really just another stop in the road for doing business logic.

    Say, for example, you had a workflow where you were bringing in demographics data and submitting it to your application’s API. You might use a Filter component for mapping from the source format (there could be multiple formats you deal with … HL7 v2, CSV, etc.) to a standardized data format, which you hand off to the destination component for processing. Sometimes it might make sense to hand off that standardized format to another channel, in which case you would be doing all the mapping in the Source or Filter components (because you cannot do transformations in a To Channel component). Your destination code may be relatively static across interfaces in these scenarios because it’s handling a standardized format.

    Casey Trauer,
    Director, Client Education
    iNTERFACEWARE

    Inbound HL7
    LLP to Channel. I add in some JSON fields to pass client specific values.

    Processing
    Channel to Translator
    Filter should read JSON and determine if the message should be processed.
    If so, pass to Translator for processing.

    I want the filter separate so I can customize it per channel, and keep the Translator generic

    So can I use the Filter as an actual filter, and allow certain messages to pass to the Translator? Or am I not using the flow properly.

    Thanks!

    Steve Ela
    Macro Helix / McKesson
    Software Developer / Integration Lead

You must be logged in to reply to this topic.