AnsweredAssumed Answered

Lentitud en envío de notificaciones

Question asked by jvivanco on Jun 18, 2018
Latest reply on Sep 3, 2018 by jvivanco

Buenas tardes,

 

Estoy utilizando ActionService  para envío de correos, tengo configurado un smtp de gmail para la salida de correos, el correo lo genero con un template ftl, el problema es que la salida del correo se demora como minimo 8 segundos, lo que es demasiado tiempo para el aplicativo.

 

El código que tengo es algo como esto: 

 

action = serviceRegistry.getActionService().createAction(MailActionExecuter.NAME);
          ResultSet resultSet;
          NodeRef template = null;
          String templateNameRepo = null;
          
          
          try {
               action.setParameterValue(MailActionExecuter.PARAM_SUBJECT, (String) parameters.get("subject"));
               action.setParameterValue(MailActionExecuter.PARAM_FROM, (String) parameters.get("from"));

               if(parameters.get("to") != null){
                    action.setParameterValue(MailActionExecuter.PARAM_TO, (String) parameters.get("to"));
               }

               String templateName = (String) parameters.get("templateName");

                    action.setParameterValue(MailActionExecuter.PARAM_TO_MANY,(Serializable) parameters.get("many"));


               if(parameters.get("templateName") != null){
                    StringBuilder templatePath = new StringBuilder("PATH:\"/app:company_home/app:dictionary/cm:templatesNotificaciones//*" + "\"");

                    resultSet = serviceRegistry.getSearchService().query(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"), SearchService.LANGUAGE_LUCENE, templatePath.toString());

                    for (ResultSetRow resultSetRow : resultSet) {
                         templateNameRepo = (String) resultSetRow.getValue(QName.createQName("http://www.alfresco.org/model/content/1.0", "name"));
                         if(templateNameRepo.equalsIgnoreCase(templateName)) {
                              template = resultSetRow.getNodeRef();
                              break;
                         }
                    }

                    action.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, template);
               }

               if(parameters.get("uuid") != null){
                    StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
                    resultSet = serviceRegistry.getSearchService().query(storeRef, SearchService.LANGUAGE_LUCENE, "@sys\\:node-uuid:\"" + parameters.get("uuid") + "\"");
                    template = resultSet.getNodeRef(0);
               }


               action.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, template);
               action.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL,(Serializable) parameters);
               serviceRegistry.getActionService().executeAction(action, null);

 

Si me pudiesen ayudar a diagnosticar la lentitud de esta operación.

 

Quedo atento a sus comentarios.

 

Saludos!

Outcomes