Announcement

Collapse
No announcement yet.

basic question regarding flow of message through a channel

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • basic question regarding flow of message through a channel

    Hi,

    1) What is the expected flow of message in a channel.

    As per my understanding it is as below.
    source connector --> preprocessor --> source transformers --> destination transformers -- > destination -- > postprocessor.

    Please correct if i am wrong.

    2) When using database reader as source connector, when is "run on update statement" executed. I expect it to run immediately after the fetch/select statement. But somehow for me it appears that , run on update runs after the destinations are executed.
    Am I missing something ??

    I am using javascript in the database reader, run on update is selected.

  • #2
    Mirth gurus, correct me if I'm wrong, but here's how I understand it:

    True raw message ->
    Global preprocessor ->
    Channel preprocessor ->
    Additional channel preprocessing as per the channel settings (stripping namespaces, LF/CR conversion, etc) -> (Source Raw Message)
    Conversion from source inbound protocol to XML ->
    Source filter ->
    Source transformer -> (Source Transformed Message)
    Conversion from XML to source outbound protocol -> (Source Encoded Message / Destination Raw Message)
    Conversion from source outbound protocol to XML ->
    Destination filter ->
    Destination transformer -> (Destination Transformed Message)
    Conversion from XML to destination outbound protocol -> (Destination Encoded Message)
    Outbound message is compiled from destination template; usually just the encoded data -> (True Outbound Message)
    Channel postprocessor; doesn't affect outbound message ->
    Global postprocessor; doesn't affect outbound message ->
    On-update statement, if a database reader source is used; if a channel isn't synchronized, then I think this runs right after the initial query code, but I'm not 100% on that, it may just not run at all...

    So, that's a very basic example... certain settings in your channel will affect the exact order of this flow. For example, if a message is filtered on the source connector, it will still run the postprocessors. If a channel is not synchronized, then destinations may run out of order, and postprocessor scripts will not run.

    Also, the postprocessors may run before or after a response is received by the destination, depending on your channel settings. An LLP sender will wait for a response before running the postprocessors, obviously because you usually don't want to run your finishing scripts until you're sure that the message has actually sent. In the case of an LLP Listener, you can set it up to respond based on the source filter or from a response variable set in the source transformer, in which case a response from your channel back to the inbound client is sent immediately. If instead the connector is set up to respond directly from a destination or from a response variable set in the destination transformer or the channel postprocessor, then obviously a response will not be sent back to the inbound client until all of the destinations have finished processing.

    If there are no transformer steps in a connector, then no Transformed Message is created and saved to the database for that connector, but the message is still converted to and from XML, because the inbound/outbound protocols may be different.

    As you can see, it can get rather complex....
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      Hi narupley;

      That's a pretty detailed description and I think you've got most of it right.

      IMO, if you're looking at where to insert code and filters this is the basic flow:

      Raw Message -->
      Pre-Processor -->
      Source Filters -->
      Source Transformers -->
      Destination Filters -->
      Destination Transformers -->
      Destination -->
      Post-Processors


      To answer your second question I believe the "run on update" is run after you do your initial database read. I haven't played with it, but my concern is that it will run the update statement even if the message fails.

      In my a PoC channel with a DB reader I set the processed field to true in the post processor if I get a successful return.
      I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
      http://www.linkedin.com/pub/david-rothbauer/5/923/518
      codeismydrug.wordpress.com
      hl7coders.wordpress.com

      Test all my code suggestions prior to implementation

      Comment


      • #4
        Thanks Narupley and Bostad. I am clear with message flow .

        I still need some answer on "run on update" statement. It is still confusing me.
        My channel is synchronized and it appears that run on update is run after the destinations are processed. But this is not the desired behavior.

        Comment


        • #5
          Hi;

          Like I said, I've never used it.

          The best way to find out might be to set up a test channel and db and give it a shot.
          I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
          http://www.linkedin.com/pub/david-rothbauer/5/923/518
          codeismydrug.wordpress.com
          hl7coders.wordpress.com

          Test all my code suggestions prior to implementation

          Comment


          • #6
            Originally posted by satyam View Post
            Thanks Narupley and Bostad. I am clear with message flow .

            I still need some answer on "run on update" statement. It is still confusing me.
            My channel is synchronized and it appears that run on update is run after the destinations are processed. But this is not the desired behavior.
            That's the expected behaviour; I believe that the "run on update" code will run immediately (and asynchronously) after the query itself if the channel is not synchronized. If the channel is synchronized, then it will run after your postprocessors I think.

            A simple way around that would be to change your query code from SQL to JavaScript and make it do whatever you want. I'm not sure, but you may also be able to run multiple statements within the initial query SQL code as well. I always use JavaScript anyway though, so I've never actually tried that.
            Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

            Nicholas Rupley
            Work: 949-237-6069
            Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


            - How do I foo?
            - You just bar.

            Comment

            Working...
            X