Announcement

Collapse
No announcement yet.

File Reader Channel - Variable as Directory

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

  • File Reader Channel - Variable as Directory

    Hi All,

    I'm not sure if this is a defect, or intended behaviour. I have created a File Reader Channel to pick up HL7 messages dumped into a specific location. When I hard code the Directory it picks the files up correctly, but when I try to use a Global Variable, it doesn't seem to work (although clicking on "Test Read" indicates that it's successful).

    It does seem to accept the Variable in the output directory values, just not in the input.

    I'm using 3.0.0.6824. Below are the exports showing the relevant settings.

    Variable
    Code:
    <list>
      <codeTemplate version="3.0.0">
        <id>ccdb2c0d-c46d-485a-bca2-348015838fa4</id>
        <name>HL7InputLocation</name>
        <tooltip></tooltip>
        <code>C:\HL7Messages</code>
        <type>VARIABLE</type>
        <scope>0</scope>
      </codeTemplate>
    </list>
    Channel
    Code:
      <sourceConnector version="3.0.0">
        <metaDataId>0</metaDataId>
        <name>sourceConnector</name>
        <properties class="com.mirth.connect.connectors.file.FileReceiverProperties" version="3.0.0">
          <pollConnectorProperties version="3.0.0">
            <pollingType>interval</pollingType>
            <pollingHour>0</pollingHour>
            <pollingMinute>0</pollingMinute>
            <pollingFrequency>5000</pollingFrequency>
          </pollConnectorProperties>
          <responseConnectorProperties version="3.0.0">
            <responseVariable>Auto-generate (Destinations completed)</responseVariable>
            <defaultQueueOnResponses>
              <string>None</string>
              <string>Auto-generate (Before processing)</string>
            </defaultQueueOnResponses>
            <defaultQueueOffResponses>
              <string>None</string>
              <string>Auto-generate (Before processing)</string>
              <string>Auto-generate (After source transformer)</string>
              <string>Auto-generate (Destinations completed)</string>
              <string>Postprocessor</string>
            </defaultQueueOffResponses>
            <respondAfterProcessing>true</respondAfterProcessing>
          </responseConnectorProperties>
          <scheme>FILE</scheme>
          <host>${HL7InputLocation}</host>
          <fileFilter>*</fileFilter>
          <regex>false</regex>
          <directoryRecursion>false</directoryRecursion>
          <ignoreDot>true</ignoreDot>
          <anonymous>true</anonymous>
          <username>anonymous</username>
          <password>anonymous</password>
          <timeout>10000</timeout>
          <secure>true</secure>
          <passive>true</passive>
          <validateConnection>true</validateConnection>
          <afterProcessingAction>MOVE</afterProcessingAction>
          <moveToDirectory>/Processed</moveToDirectory>
          <moveToFileName>${originalFilename}</moveToFileName>
          <errorReadingAction>MOVE</errorReadingAction>
          <errorResponseAction>AFTER_PROCESSING</errorResponseAction>
          <errorMoveToDirectory>/Errored</errorMoveToDirectory>
          <errorMoveToFileName>${originalFilename}</errorMoveToFileName>
          <checkFileAge>false</checkFileAge>
          <fileAge>1000</fileAge>
          <fileSizeMinimum>0</fileSizeMinimum>
          <fileSizeMaximum></fileSizeMaximum>
          <ignoreFileSizeMaximum>true</ignoreFileSizeMaximum>
          <sortBy>date</sortBy>
          <binary>false</binary>
          <charsetEncoding>DEFAULT_ENCODING</charsetEncoding>
          <processBatch>false</processBatch>
        </properties>
        <transformer version="3.0.0">
          <steps/>
          <inboundTemplate encoding="base64"></inboundTemplate>
          <outboundTemplate encoding="base64"></outboundTemplate>
          <inboundDataType>HL7V2</inboundDataType>
          <outboundDataType>HL7V2</outboundDataType>
          <inboundProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2DataTypeProperties" version="3.0.0">
            <serializationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2SerializationProperties" version="3.0.0">
              <handleRepetitions>true</handleRepetitions>
              <handleSubcomponents>true</handleSubcomponents>
              <useStrictParser>false</useStrictParser>
              <useStrictValidation>false</useStrictValidation>
              <stripNamespaces>true</stripNamespaces>
              <segmentDelimiter>\r</segmentDelimiter>
              <convertLineBreaks>true</convertLineBreaks>
            </serializationProperties>
            <deserializationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2DeserializationProperties" version="3.0.0">
              <useStrictParser>false</useStrictParser>
              <useStrictValidation>false</useStrictValidation>
              <segmentDelimiter>\r</segmentDelimiter>
            </deserializationProperties>
            <responseGenerationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2ResponseGenerationProperties" version="3.0.0">
              <segmentDelimiter>\r</segmentDelimiter>
              <successfulACKCode>AA</successfulACKCode>
              <successfulACKMessage></successfulACKMessage>
              <errorACKCode>AE</errorACKCode>
              <errorACKMessage>An Error Occured Processing Message.</errorACKMessage>
              <rejectedACKCode>AR</rejectedACKCode>
              <rejectedACKMessage>Message Rejected.</rejectedACKMessage>
              <msh15ACKAccept>false</msh15ACKAccept>
            </responseGenerationProperties>
            <responseValidationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2ResponseValidationProperties" version="3.0.0">
              <successfulACKCode>AA</successfulACKCode>
              <errorACKCode>AE</errorACKCode>
              <rejectedACKCode>AR</rejectedACKCode>
            </responseValidationProperties>
          </inboundProperties>
          <outboundProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2DataTypeProperties" version="3.0.0">
            <serializationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2SerializationProperties" version="3.0.0">
              <handleRepetitions>true</handleRepetitions>
              <handleSubcomponents>true</handleSubcomponents>
              <useStrictParser>false</useStrictParser>
              <useStrictValidation>false</useStrictValidation>
              <stripNamespaces>true</stripNamespaces>
              <segmentDelimiter>\r</segmentDelimiter>
              <convertLineBreaks>true</convertLineBreaks>
            </serializationProperties>
            <deserializationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2DeserializationProperties" version="3.0.0">
              <useStrictParser>false</useStrictParser>
              <useStrictValidation>false</useStrictValidation>
              <segmentDelimiter>\r</segmentDelimiter>
            </deserializationProperties>
            <responseGenerationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2ResponseGenerationProperties" version="3.0.0">
              <segmentDelimiter>\r</segmentDelimiter>
              <successfulACKCode>AA</successfulACKCode>
              <successfulACKMessage></successfulACKMessage>
              <errorACKCode>AE</errorACKCode>
              <errorACKMessage>An Error Occured Processing Message.</errorACKMessage>
              <rejectedACKCode>AR</rejectedACKCode>
              <rejectedACKMessage>Message Rejected.</rejectedACKMessage>
              <msh15ACKAccept>false</msh15ACKAccept>
            </responseGenerationProperties>
            <responseValidationProperties class="com.mirth.connect.plugins.datatypes.hl7v2.HL7v2ResponseValidationProperties" version="3.0.0">
              <successfulACKCode>AA</successfulACKCode>
              <errorACKCode>AE</errorACKCode>
              <rejectedACKCode>AR</rejectedACKCode>
            </responseValidationProperties>
          </outboundProperties>
        </transformer>
        <filter version="3.0.0">
          <rules/>
        </filter>
        <transportName>File Reader</transportName>
        <mode>SOURCE</mode>
        <enabled>true</enabled>
        <waitForPrevious>true</waitForPrevious>
      </sourceConnector>

  • #2
    I think you have a misunderstanding about the difference between global map variables and code templates. A type "Variable" or "Code" code template is simply a convenience mechanism that allows you to drag-and-drop pre-defined blocks of code into a transformer or script. The "Function" code template is only different in that it's actually compiled in with all scripts, and then the drag-and-drop functionality simply transfers the call line of the first function in the code.

    If you want a global map variable to be replaced during deploy or message processing, then you need to actually place something in the global map (for example, in the channel's deploy script).
    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
      Thanks Narupley. So I think I'm still confused somewhat, perhaps if I tell you what I want to achieve, you can advise the best way to actually achieve that.

      We're storing our channel exports in source control, and have automatic processes in place for deployment to our QA/Stage/Prod environments. The idea is that our channels are completely identical between each of the environments in order to ensure that we test the channels exactly as they will function in prod.

      In the case of the FS Reader channel, I want to define the channel so that the directory it reads from is dictated by the server, not the channel. In local that directory is C:\HL7Messages, but in prod, that might be in a different directory (or even a different drive) as dictated by our Operations team.

      I'd thought that the Code Templates (using Variable and Global) were the intended location for things like this? If I put it into the deployment script, then it's part of the channel source, and not configurable for each server.

      Comment


      • #4
        You have not only the channel deploy script, but also the global deploy script... it sounds like that would be a better place for it.
        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


        • #5
          I guess I'm not getting it, because even adding values to the Global Deploy script I can't get the FileSystem Watcher to pick up files from the defined path.

          These are my settings:

          Global Deploy Script
          Code:
          // This script executes once when all channels start up from a redeploy
          // You only have access to the globalMap here to persist data
          globalMap.put('FileInputLocation','C:\HL7Messages');
          FileSystem Watcher.xml

          Comment


          • #6
            Originally posted by FReilly View Post
            I guess I'm not getting it, because even adding values to the Global Deploy script I can't get the FileSystem Watcher to pick up files from the defined path.

            These are my settings:

            Global Deploy Script
            Code:
            // This script executes once when all channels start up from a redeploy
            // You only have access to the globalMap here to persist data
            globalMap.put('FileInputLocation','C:\HL7Messages');
            [ATTACH]1483[/ATTACH]
            That works for me; did you redeploy your channel?
            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


            • #7
              I selected "Deploy Channel" from the options - is there a difference between it and redeploy that would cause it?

              Comment


              • #8
                Nope, it does the same thing; the global deploy script should run. What error are you seeing?
                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


                • #9
                  no error (or none that I noticed). When the path is hard coded, the file moves to the Processed directory, and the counters increment. Using the variable, the file isn't picked up and processed.

                  Comment


                  • #10
                    Originally posted by FReilly View Post
                    no error (or none that I noticed). When the path is hard coded, the file moves to the Processed directory, and the counters increment. Using the variable, the file isn't picked up and processed.
                    Can you export your entire server config and post it here? It'll be on the Settings view.
                    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


                    • #11
                      Sure, It'll be tomorrow though - I'm at home now.

                      Just a thought - you aren't testing on the nightly builds are you? I'm using 3.0.0.6824 (which is RC2?), if you are perhaps it's been resolved?

                      Comment


                      • #12
                        You know what, it's probably because of the global script:

                        Code:
                        globalMap.put('FileInputLocation','C:\\HL7Messages');
                        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


                        • #13
                          Unfortunately that didn't work either. Here is the config.

                          2013-09-12 Mirth Backup.xml

                          Thanks

                          Comment


                          • #14
                            Originally posted by FReilly View Post
                            Unfortunately that didn't work either. Here is the config.

                            [ATTACH]1485[/ATTACH]

                            Thanks
                            In your FileSystem Watcher channel, you have "C:HL7Messages" rather than "${FileInputLocation}".
                            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


                            • #15
                              It looks like the export is setting the value transformed from the deploy. That must have been from a deploy when I had C:\HL7Messages set in the globalmap.put.

                              I just redeployed with C:\\HL7Messages then exported the config, and that value is now C:\HL7Messages

                              Attached is the current export - and the Channel Directory value is definitely ${FileInputLocation}.

                              2013-09-13 Mirth Backup.xml

                              Comment

                              Working...
                              X