web stats
File Reader Channel - Variable as Directory - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-08-2013, 11:57 PM
FReilly FReilly is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 21
FReilly is on a distinguished road
Default 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>
Reply With Quote
  #2  
Old 09-09-2013, 08:06 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 09-09-2013, 11:20 PM
FReilly FReilly is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 21
FReilly is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 09-10-2013, 07:54 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 09-11-2013, 02:01 AM
FReilly FReilly is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 21
FReilly is on a distinguished road
Default

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
Reply With Quote
  #6  
Old 09-11-2013, 08:05 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Quote:
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');
Attachment 1483
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.
Reply With Quote
  #7  
Old 09-11-2013, 10:34 AM
FReilly FReilly is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 21
FReilly is on a distinguished road
Default

I selected "Deploy Channel" from the options - is there a difference between it and redeploy that would cause it?
Reply With Quote
  #8  
Old 09-11-2013, 10:37 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #9  
Old 09-11-2013, 10:38 AM
FReilly FReilly is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 21
FReilly is on a distinguished road
Default

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.
Reply With Quote
  #10  
Old 09-11-2013, 10:40 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Quote:
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.
Reply With Quote
Reply

Tags
file reader, source connector, variable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:55 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation