web stats
Mirth Community - View Single Post - Mirth 3.7 BUG - SFTP downloads slow down causing huge backlog
View Single Post
  #3  
Old 05-12-2019, 11:06 PM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 137
odo is on a distinguished road
Default

There are changes in the channel structure between 3.6.1 and 3.7. Please find below the (Java) code we use in our migration tool for conversion between both versions:

Code:
        if ((source < 3.7f) && (target >= 3.7f)) {
            switch (componentType) {
            case MirthHttpsClient.CHANNEL:
                // add enabled indicator to transformer steps
                component = component.replaceAll("</sequenceNumber>(\\s*)<script>", "</sequenceNumber>$1<enabled>true</enabled>$1<script>");
                // add enable indicator to filters
                component = component.replaceAll("</sequenceNumber>(\\s*)<operator>", "</sequenceNumber>$1<enabled>true</enabled>$1<operator>");
                // file connector can now define an idle timeout after which the connection is closed. (0 means no timeout - DEFAULT)
                component = component.replaceAll("(</destinationConnectorProperties>\\s+<scheme>FILE</scheme>.+</timeout>)(\\s*)", "$1$2<maxIdleTime>0</maxIdleTime>$2");
                // file connector can now close connection to the file system when not writing
                component = component.replaceAll("(</destinationConnectorProperties>\\s+<scheme>FILE</scheme>.+</timeout>)(\\s*)", "$1$2<keepConnectionOpen>true</keepConnectionOpen>$2");
                // javascript step has now a mirth version attribute (whatsoever...)
                component = component.replaceAll("<com.mirth.connect.plugins.javascriptstep.JavaScriptStep>", "<com.mirth.connect.plugins.javascriptstep.JavaScriptStep version=\"" + targetVersion.getVersionString() + "\">");
                component = component.replaceAll("<com.mirth.connect.plugins.javascriptrule.JavaScriptRule>", "<com.mirth.connect.plugins.javascriptrule.JavaScriptRule version=\"" + targetVersion.getVersionString() + "\">");
                
                break;
            case <HANDLING OF CODE TEMPLATES && CONTAINERS...>

         } else if ((source >= 3.7f) && (target < 3.7f)) {
            switch (componentType) {
            case MirthHttpsClient.CHANNEL:
                // remove enabled indicator from transformer steps
                component = component.replaceAll("</sequenceNumber>(\\s*)<enabled>[^<]*</enabled>\\s*<script>", "</sequenceNumber>$1<script>");
                // remove enabled indicators form filter rules
                component = component.replaceAll("</sequenceNumber>(\\s*)<enabled>[^<]*</enabled>\\s*<operator>", "</sequenceNumber>$1<operator>");
                // remove "keep connection open" parameter from  file connector
                component = component.replaceAll("</timeout>(\\s*)<keepConnectionOpen>[^<]*</keepConnectionOpen>\\s*<maxIdleTime>", "</timeout>$1<maxIdleTime>");
                // remove "idle timeout" parameter from file connector
                component = component.replaceAll("</timeout>(\\s*)<maxIdleTime>[^<]*</maxIdleTime>\\s*<secure>", "</timeout>$1<secure>");
                // remove version attributes from javascript steps and filter rules
                component = component.replaceAll("<com.mirth.connect.plugins.javascriptstep.JavaScriptStep [^>]+>", "<com.mirth.connect.plugins.javascriptstep.JavaScriptStep>");
                component = component.replaceAll("<com.mirth.connect.plugins.javascriptstep.JavaScriptRule [^>]+>", "<com.mirth.connect.plugins.javascriptstep.JavaScriptRule>");

                 break;
            case  <HANDLING OF CODE TEMPLATES && CONTAINERS...>

           }
The green part should be of interest for you. The comments in blue hopefully help to clarify what is going on.

Further, there might be other elements that changed but as the changes are not (publicly) documented we'll add them if they occur.


Finally, the version number of the version attributes also has to be adjusted to the target version. (which should be 3.6.1 in this case)
This is not handled in the shown code segment but can easily be coped with another replaceAll().

Last edited by odo; 05-12-2019 at 11:12 PM.
Reply With Quote