No announcement yet.

File connector as source

  • Filter
  • Time
  • Show
Clear All
new posts

  • File connector as source

    Hi all,

    I've setup a channel with the following parameters:

    source: SFTP Reader
    destination: (1), as SOAP Sender

    The SOAP request is served by another box, that is configured to raise an exception every time. The exception is raised as described in:

    When I test the channel with the "send message" feature from the dashboard, the webservice returns a SOAP fault, and it's understook as an error by Mirth, as shown in the dashboard statistics.

    Now, when testing the whole channel, the SFTP reader has the following setup:

    username: mirth
    password: xxxxx
    file-pattern: *
    polling-type: interval, 1s
    move-to-directory: /data/out
    move-to-filename: ${ORIGINALNAME}
    error-move-to-directory: /data/err
    delete after-read: no
    check-file-age: no
    file-type: ASCII
    process-batch-files: no
    sort-files-by: name
    encoding: default

    Well, the expected behaviour is:
    every 1s, Mirth opens a SFTP session to the remote server.
    List the contents of /data/in (ordered by name)
    Reads the first file
    starts it's processing: tries to send it's content over the SOAP destination
    A soap:fault is returned by the webservice, so the message causes an error.
    then, the file is moved to the error-move-to-directory
    the connection to the sftp server get closed.

    Insted of this, I get the message files moved to the move-to-directory directory, despite the SOAP destination is returning a soap:fault on every response.

    In addition to this test, I tried the same configuration but:
    error-move-to-directory=/data/in , the same directory where is reading files, to get a sort of "retry". The goal of this test is: if any message gets an error in it's processing, is moved again to the "input" directory and in the next poll, the same message will the the next to try, as the sorting method ("name") is the same.

    Well, the questions are:
    * If the message gets an error in the processing, why isn't moved to the error-dir instead of the move-to?
    * I'm about to check the sources related to the file connector, any clue to see where this behaviour may be changed ?
    * Is there a kind of "scope" of the error that a source connector can manage ? Can it be modified ?
    * In the case that there is no way to modify this, how can I implement a SFTP Reader+SOAP Sender inside a JS Reader from scratch ?
    * What is the meaning of the "Check file Age" feature ?

    Thanks in advance.

  • #2
    Re:File connector as source


    The reader will only move the file to the error dir if the exception occurs when reading the file, or during the filter/transform. It does not check the status of the destinations.

    If "Check File Age" is enabled and a "File Age" value is set, the reader will only process files that are older than the set file age. For example, if you set the value to 60, the file reader will only read files older than 1 minute.

    Hope this helps.
    Gerald Bortis | Chief Information Officer | Mirth Corporation


    • #3
      I found I could catch errors produced by a destination by adding a final "catch all" destination with the following javascript filter:

      var success = responseMap.get("PreviousDestinationYouAreChecking ").getStatus();
      if (success == "SUCCESS")
      return false; //It was don't process here
      return true; //It was not sucessful, so catch it here