making emails asynv

This commit is contained in:
Antonis Lempesis 2021-10-21 12:30:53 +00:00
parent 06811ea64c
commit 06d657d522
3 changed files with 54 additions and 8 deletions

View File

@ -0,0 +1,27 @@
package eu.dnetlib.repo.manager.config;
import eu.dnetlib.repo.manager.service.ValidatorServiceImpl;
import org.apache.log4j.Logger;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import java.lang.reflect.Method;
@Configuration
@EnableAsync
public class AsyncConfiguration implements AsyncConfigurer {
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new AsyncUncaughtExceptionHandler() {
private final Logger logger = Logger.getLogger(getClass());
@Override
public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
//logger.error("Async error", throwable);
}
};
}
}

View File

@ -11,17 +11,13 @@ import gr.uoa.di.driver.enabling.islookup.ISLookUpImpl;
import gr.uoa.di.driver.util.ServiceLocator;
import gr.uoa.di.driver.util.StaticServiceLocator;
import gr.uoa.di.driver.xml.VocabularyXmlConverter;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
@Configuration
//@ImportResource({"classpath*:/gr/**/springContext-*.xml","/eu/dnetlib/clients/ws/springContext-locatorFactory.xml","/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml","/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"})
@ImportResource("application-compat.xml")
@PropertySource("application-compat.properties")
public class Config {
@Value("${ISLookUpService.url}")
@ -33,10 +29,8 @@ public class Config {
private ServiceLocator<ISLookUpService> createIsLookupServiceLocator() throws Exception {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
//factory.setServiceClass(eu.dnetlib.services.ISLookUpService.class);
factory.setServiceClass(eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService.class);
factory.setAddress(lookupURL);
//eu.dnetlib.services.ISLookUpService client = (eu.dnetlib.services.ISLookUpService) factory.create();
eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService client = (eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService) factory.create();
ISLookUpClient service = new ISLookUpClient();
@ -75,5 +69,4 @@ public class Config {
return locator;
}
}

View File

@ -4,66 +4,92 @@ import eu.dnetlib.domain.data.PiwikInfo;
import eu.dnetlib.domain.data.Repository;
import eu.dnetlib.domain.data.RepositoryInterface;
import eu.dnetlib.domain.functionality.validator.JobForValidation;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.Authentication;
public interface EmailUtils {
@Async
void sendAdministratorRequestToEnableMetrics(PiwikInfo piwikInfo) throws Exception;
@Async
void sendUserRequestToEnableMetrics(PiwikInfo piwikInfo) throws Exception;
@Async
void sendAdministratorMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
@Async
void sendUserMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
/****USER REGISTRATION REQUEST EMAILS****/
@Async
void sendAdminRegistrationEmail(Repository repository, Authentication authentication) throws Exception;
@Async
void sendUserRegistrationEmail(Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception;
@Async
void sendUserRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception;
/****SUCCESSFUL REGISTRATION RESULTS EMAILS****/
@Async
void sendUserRegistrationResultsSuccessEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminRegistrationResultsSuccessEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
/****FAILURE REGISTRATION RESULTS EMAILS****/
@Async
void sendUserRegistrationResultsFailureEmail(String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminRegistrationResultsFailureEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
/****SUCCESSFUL UPDATE RESULTS EMAILS****/
@Async
void sendUserUpdateResultsSuccessEmail(String issuer, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminUpdateResultsSuccessEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
/****FAILURE UPDATE RESULTS EMAILS****/
@Async
void sendUserUpdateResultsFailureEmail(String issuer, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminUpdateResultsFailureEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
/****VALIDATION OF CONTENT PROVIDER EMAILS****/
@Async
void sendUserValidationResults(String issuer,String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminValidationResults(String issuer,String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
/****GENERAL FAILURE OF VALIDATOR****/
@Async
void sendAdminGeneralFailure(String issuer,String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception;
@Async
void sendUserUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception;
@Async
void sendAdminUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception;
@Async
void sendUserUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception;
@Async
void sendSubmitJobForValidationEmail(Authentication authentication, JobForValidation jobForValidation) throws Exception;
@Async
void sendUponJobCompletion(String repoId,
String repoInterfaceId,
int scoreUsage,