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!
Hola,
Has probado mandar un mail via ese mismo server desde una application java?
Recomendaria revisar exactamente a donde pasan esos 8 segundos exactamente. Lograste identificar que linea es la que se toma ese tiempo?
Saludos
Ya lo resolví, existía un timeout asociado, muchas gracias de todas maneras
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.