Announcement

Collapse
No announcement yet.

Connection: Polling

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

  • Connection: Polling

    Hi to everyone!

    I'm using Mirth for moving PDF files, the use is simple

    source: reads from a folder (smb protocol)
    destination: writes the file in another folder and changes the name.
    transformer (destination): write some SQL sencences.

    It usually works but sometimes I don't know why the channel changes to 'Polling' for a long time, it has files to read and it doesn't read any till I restart Mirth again.

    I have this problem since May, and this channel must be working always, but sometimes I realize it's not reading files and I have to restart.

    Does anyone know the reason? is it a kind of bug? I've tried to find if there is any thread about this, but i couldn't find anything.

  • #2
    It sounds like the channel is hanging. The only code you are indicating is SQL. There is a possiblity that there is a dead lock or loop in the code that generates the SQL that doesn't have a way out. If you can post your channel here, someone on the forum can help.

    Comment


    • #3
      We had a similar issue with polling (unrelated to files or SQL, but web services) and resolved it by moving to v2.2.1. Before we were able to upgrade, we worked-around the issue by re-deploying the channel using another channel.

      Comment


      • #4
        transformer's code

        Hi to everyone,
        First of all, thanks for your replies!! I put the code if it can help to get a solution.

        Sorry for some spanish tags

        var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('xxx','xxx','xxxxx','xxxxx');
        var sql='select pers.docu_key as docu_key from pati, pers where pers.pers_key=pati.pers_key and pati.pati_hfn =' + nhc;
        var result = dbConn.executeCachedQuery(sql);

        if(result.next()){ //PACIENT FOUND

        var docu_key = result.getString("docu_key");

        //BUILD THE FILE NAME
        var tipo_doc = fichero.substr(0,3);
        var nomfich = nhc + '_' + tipo_doc + '_' + fechaHora + ".pdf";

        //CHECK IN PHISDOCU TABLE

        var sql='select count(*) as lineas from phisdocu where docu_key=' + docu_key +
        ' and datavolucode =' + tipo_doc + ' and phisdocuname="' + nomfich + '"';
        var result = dbConn.executeCachedQuery(sql);

        result.next();
        if(result.getString("lineas")==0){ //IF IT DOESN'T EXIST

        //INSERT IN PHISDOCU

        var result=dbConn.executeUpdate("INSERT IGNORE INTO phisdocu (docu_key, phisdocu_key, datavolucode, phisdocuname, phisdocuvolupath, phisdocu_url, phisdocudate, phisdocuanul)"+
        " VALUES (" + docu_key + ", " + cont + ", '" + tipo_doc + "', '" + nomfich.toString() + "', '" + anyo_examen + "', 'N', '" + datestring + "', 'N')");
        if(result){
        var ruta_dest = tipo_doc + '/' + anyo_examen;
        //logger.info("Documento insertado correctamente");
        }
        else{
        var ruta_dest='errores';
        var nomfich = fichero;
        var tipo_error = "Error al insertar en phisdocu";
        //logger.info(tipo_error);
        }
        }
        else{ //FILE ALREADY EXISTS
        var ruta_dest='errores';
        var nomfich = fichero;
        var tipo_error = "El fichero ya existe en phisdocu";
        //logger.info(tipo_error);
        }
        }


        It only happens to me in this channel and it seems that everything is ok with the code apparently...

        Thanks in advance!
        Last edited by CrisHosp; 02-27-2013, 02:39 AM. Reason: Wrong title

        Comment

        Working...
        X