Commit 8e102206 authored by Matija Obreza's avatar Matija Obreza

Merge branch '424-accessionuploader-delete-operation' into 'master'

AccessionUploader: delete operation

Closes #424

See merge request genesys-pgr/genesys-server!363
parents 167dfd29 793eb2c3
...@@ -46,7 +46,7 @@ import java.util.Set; ...@@ -46,7 +46,7 @@ import java.util.Set;
@Table(name = "partner") @Table(name = "partner")
@Cacheable @Cacheable
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid") @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid")
@Document(indexName = "catalog") @Document(indexName = "partner")
public class Partner extends UuidModel implements SelfCleaning, AclAwareModel { public class Partner extends UuidModel implements SelfCleaning, AclAwareModel {
private static final ClassAclOid<Partner> PARENT_OID = ClassAclOid.forClass(Partner.class); private static final ClassAclOid<Partner> PARENT_OID = ClassAclOid.forClass(Partner.class);
......
...@@ -74,7 +74,7 @@ import com.fasterxml.jackson.annotation.JsonView; ...@@ -74,7 +74,7 @@ import com.fasterxml.jackson.annotation.JsonView;
@Table(name = "dataset") @Table(name = "dataset")
@Cacheable @Cacheable
@Audited @Audited
@Document(indexName = "catalog") @Document(indexName = "dataset")
public class Dataset extends UuidModel implements Publishable, SelfCleaning, PublishValidationInterface, AclAwareModel { public class Dataset extends UuidModel implements Publishable, SelfCleaning, PublishValidationInterface, AclAwareModel {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
......
...@@ -46,7 +46,7 @@ import java.util.List; ...@@ -46,7 +46,7 @@ import java.util.List;
@Table(name = "descriptor") @Table(name = "descriptor")
@Audited @Audited
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid") @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid")
@Document(indexName = "catalog") @Document(indexName = "descriptor")
public class Descriptor extends UuidModel implements SelfCleaning, Publishable, Copyable<Descriptor>, AclAwareModel { public class Descriptor extends UuidModel implements SelfCleaning, Publishable, Copyable<Descriptor>, AclAwareModel {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
......
...@@ -48,7 +48,7 @@ import java.util.Map; ...@@ -48,7 +48,7 @@ import java.util.Map;
@Audited @Audited
@Cacheable @Cacheable
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid") @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid")
@Document(indexName = "catalog") @Document(indexName = "descriptorlist")
public class DescriptorList extends UuidModel implements Publishable, SelfCleaning, AclAwareModel { public class DescriptorList extends UuidModel implements Publishable, SelfCleaning, AclAwareModel {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
......
...@@ -44,7 +44,7 @@ import java.util.List; ...@@ -44,7 +44,7 @@ import java.util.List;
@Entity @Entity
@Table(name = "vocabulary") @Table(name = "vocabulary")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid") @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid")
@Document(indexName = "catalog") @Document(indexName = "controlledvocabulary")
public class ControlledVocabulary extends UuidModel implements Publishable, SelfCleaning, AclAwareModel { public class ControlledVocabulary extends UuidModel implements Publishable, SelfCleaning, AclAwareModel {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
......
...@@ -46,7 +46,7 @@ import java.text.MessageFormat; ...@@ -46,7 +46,7 @@ import java.text.MessageFormat;
*/ */
@Entity @Entity
@Table(name = "term") @Table(name = "term")
@Document(indexName = "catalog") @Document(indexName = "vocabularyterm")
public class VocabularyTerm extends BasicModel implements SelfCleaning { public class VocabularyTerm extends BasicModel implements SelfCleaning {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
......
...@@ -29,7 +29,6 @@ import org.aspectj.lang.JoinPoint; ...@@ -29,7 +29,6 @@ import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.genesys.blocks.model.BasicModel; import org.genesys.blocks.model.BasicModel;
import org.genesys2.server.service.ElasticsearchService; import org.genesys2.server.service.ElasticsearchService;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -89,8 +88,8 @@ public class ElasticJPAListener { ...@@ -89,8 +88,8 @@ public class ElasticJPAListener {
* *
* @param joinPoint the join point * @param joinPoint the join point
*/ */
@Before(value = "execution(* org.springframework.data.jpa.repository.JpaRepository.delete(..)) || execution(* org.springframework.data.jpa.repository.JpaRepository.deleteInBatch(..))") @After(value = "execution(* org.springframework.data.jpa.repository.JpaRepository.delete(..)) || execution(* org.springframework.data.jpa.repository.JpaRepository.deleteInBatch(..))")
public void beforeRemove(final JoinPoint joinPoint) { public void afterRemove(final JoinPoint joinPoint) {
final Object[] args = joinPoint.getArgs(); final Object[] args = joinPoint.getArgs();
try { try {
final Object removed = args[0]; final Object removed = args[0];
......
...@@ -46,7 +46,7 @@ import org.springframework.data.elasticsearch.annotations.Document; ...@@ -46,7 +46,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
@Index(name = "IX_accession_lastModifiedDate", columnList = "lastModifiedDate"), @Index(name = "IX_accession_lastModifiedDate", columnList = "lastModifiedDate"),
@Index(name = "IX_accession_createdDate", columnList = "createdDate")}) @Index(name = "IX_accession_createdDate", columnList = "createdDate")})
@Audited @Audited
@Document(indexName = "genesys") @Document(indexName = "accession")
public class Accession extends AccessionData { public class Accession extends AccessionData {
/** /**
* *
......
...@@ -29,9 +29,11 @@ import javax.validation.constraints.Size; ...@@ -29,9 +29,11 @@ import javax.validation.constraints.Size;
import org.genesys.blocks.model.AuditedVersionedModel; import org.genesys.blocks.model.AuditedVersionedModel;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.springframework.data.elasticsearch.annotations.Document;
@Entity @Entity
@Table(name = "activitypost") @Table(name = "activitypost")
@Document(indexName = "activitypost")
public class ActivityPost extends AuditedVersionedModel { public class ActivityPost extends AuditedVersionedModel {
private static final long serialVersionUID = 8690395020204070378L; private static final long serialVersionUID = 8690395020204070378L;
......
...@@ -32,9 +32,11 @@ import javax.validation.constraints.Size; ...@@ -32,9 +32,11 @@ import javax.validation.constraints.Size;
import org.genesys.blocks.model.AuditedVersionedModel; import org.genesys.blocks.model.AuditedVersionedModel;
import org.genesys.blocks.model.ClassPK; import org.genesys.blocks.model.ClassPK;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.springframework.data.elasticsearch.annotations.Document;
@Entity @Entity
@Table(name = "article") @Table(name = "article")
@Document(indexName = "article")
public class Article extends AuditedVersionedModel { public class Article extends AuditedVersionedModel {
private static final long serialVersionUID = 8690395020204070378L; private static final long serialVersionUID = 8690395020204070378L;
......
...@@ -39,6 +39,7 @@ import org.genesys.blocks.model.BasicModel; ...@@ -39,6 +39,7 @@ import org.genesys.blocks.model.BasicModel;
import org.genesys.blocks.model.JsonViews; import org.genesys.blocks.model.JsonViews;
import org.genesys.custom.elasticsearch.IgnoreField; import org.genesys.custom.elasticsearch.IgnoreField;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
...@@ -50,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -50,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Cacheable @Cacheable
@Entity @Entity
@Table(name = "country") @Table(name = "country")
@Document(indexName = "country")
public class Country extends BasicModel { public class Country extends BasicModel {
private static final long serialVersionUID = -1688723909298769804L; private static final long serialVersionUID = -1688723909298769804L;
......
...@@ -51,6 +51,7 @@ import org.genesys2.server.model.GlobalVersionedAuditedModel; ...@@ -51,6 +51,7 @@ import org.genesys2.server.model.GlobalVersionedAuditedModel;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.data.elasticsearch.annotations.Document;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;
...@@ -60,6 +61,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -60,6 +61,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Cacheable @Cacheable
@Entity @Entity
@Table(name = "crop") @Table(name = "crop")
@Document(indexName = "crop")
public class Crop extends GlobalVersionedAuditedModel implements SelfCleaning, AclAwareModel { public class Crop extends GlobalVersionedAuditedModel implements SelfCleaning, AclAwareModel {
private static final long serialVersionUID = -2686341831839109257L; private static final long serialVersionUID = -2686341831839109257L;
......
...@@ -38,6 +38,7 @@ import org.genesys.blocks.util.ClassAclOid; ...@@ -38,6 +38,7 @@ import org.genesys.blocks.util.ClassAclOid;
import org.genesys.catalog.model.Partner; import org.genesys.catalog.model.Partner;
import org.genesys.custom.elasticsearch.IgnoreField; import org.genesys.custom.elasticsearch.IgnoreField;
import org.genesys2.server.model.genesys.PDCIStatistics; import org.genesys2.server.model.genesys.PDCIStatistics;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex; import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
...@@ -51,6 +52,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -51,6 +52,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Cacheable @Cacheable
@Entity @Entity
@Table(name = "faoinstitute", uniqueConstraints = @UniqueConstraint(columnNames = { "code" }), indexes = { @Index(columnList = "code", name = "code_FAOINSTITUTE") }) @Table(name = "faoinstitute", uniqueConstraints = @UniqueConstraint(columnNames = { "code" }), indexes = { @Index(columnList = "code", name = "code_FAOINSTITUTE") })
@Document(indexName = "faoinstitute")
public class FaoInstitute extends BasicModel implements GeoReferencedEntity, AclAwareModel, EntityId { public class FaoInstitute extends BasicModel implements GeoReferencedEntity, AclAwareModel, EntityId {
private static final ClassAclOid<FaoInstitute> DEFAULT_PARENT_OID = ClassAclOid.forClass(FaoInstitute.class); private static final ClassAclOid<FaoInstitute> DEFAULT_PARENT_OID = ClassAclOid.forClass(FaoInstitute.class);
......
...@@ -21,6 +21,7 @@ import java.util.ArrayList; ...@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -88,7 +89,7 @@ import org.springframework.data.elasticsearch.core.query.SearchQuery; ...@@ -88,7 +89,7 @@ import org.springframework.data.elasticsearch.core.query.SearchQuery;
import org.springframework.data.elasticsearch.core.query.SourceFilter; import org.springframework.data.elasticsearch.core.query.SourceFilter;
import org.springframework.data.jpa.repository.support.Querydsl; import org.springframework.data.jpa.repository.support.Querydsl;
import org.springframework.data.querydsl.SimpleEntityPathResolver; import org.springframework.data.querydsl.SimpleEntityPathResolver;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.TaskScheduler;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -119,7 +120,7 @@ public class ElasticsearchServiceImpl implements ElasticsearchService, Initializ ...@@ -119,7 +120,7 @@ public class ElasticsearchServiceImpl implements ElasticsearchService, Initializ
protected static final SourceFilter DEFAULT_SOURCE_FILTER = new FetchSourceFilter(new String[] { "id", "_class", "title", "code", "description" }, new String[] {}); protected static final SourceFilter DEFAULT_SOURCE_FILTER = new FetchSourceFilter(new String[] { "id", "_class", "title", "code", "description" }, new String[] {});
@Autowired @Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor; private TaskScheduler taskScheduler;
@Autowired @Autowired
private EntityManager em; private EntityManager em;
...@@ -336,17 +337,14 @@ public class ElasticsearchServiceImpl implements ElasticsearchService, Initializ ...@@ -336,17 +337,14 @@ public class ElasticsearchServiceImpl implements ElasticsearchService, Initializ
ensureWriteAlias(clazz); ensureWriteAlias(clazz);
threadPoolTaskExecutor.execute(new Runnable() { taskScheduler.schedule(() -> {
@Override LOG.debug("Running scheduled reindex of {} size={}", clazz.getName(), copy.size());
public void run() { try {
// LOG.debug("Reindexing {} size={}", clazz.getName(), copy.size()); _self.update(clazz, copy);
try { } catch (Throwable e) {
_self.update(clazz, copy); LOG.error(e.getMessage(), e);
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
}
} }
}); }, new Date(System.currentTimeMillis() + 5000));
} }
/** /**
...@@ -424,10 +422,12 @@ public class ElasticsearchServiceImpl implements ElasticsearchService, Initializ ...@@ -424,10 +422,12 @@ public class ElasticsearchServiceImpl implements ElasticsearchService, Initializ
// } // }
em.clear(); em.clear();
queries.clear();
for (Long id : notFoundIds) { for (Long id : notFoundIds) {
LOG.debug("Removing from index {} {}", clazz.getName(), id); LOG.trace("Removing {} id={} from index {}/{}", clazz.getName(), id, indexName, COMMON_TYPE_NAME);
elasticsearchTemplate.delete(indexName, COMMON_TYPE_NAME, String.valueOf(id)); String res = elasticsearchTemplate.delete(indexName, COMMON_TYPE_NAME, String.valueOf(id));
LOG.trace("Deleted ES document id={}", res);
} }
} }
......
...@@ -44,13 +44,17 @@ import org.genesys2.server.model.genesys.AccessionAlias; ...@@ -44,13 +44,17 @@ import org.genesys2.server.model.genesys.AccessionAlias;
import org.genesys2.server.model.genesys.AccessionAlias.AliasType; import org.genesys2.server.model.genesys.AccessionAlias.AliasType;
import org.genesys2.server.model.genesys.AccessionCollect; import org.genesys2.server.model.genesys.AccessionCollect;
import org.genesys2.server.model.genesys.AccessionGeo; import org.genesys2.server.model.genesys.AccessionGeo;
import org.genesys2.server.model.genesys.AccessionHistoric;
import org.genesys2.server.model.genesys.AccessionId; import org.genesys2.server.model.genesys.AccessionId;
import org.genesys2.server.model.genesys.AccessionRemark; import org.genesys2.server.model.genesys.AccessionRemark;
import org.genesys2.server.model.genesys.PDCI; import org.genesys2.server.model.genesys.PDCI;
import org.genesys2.server.model.genesys.SelfCopy;
import org.genesys2.server.model.genesys.Taxonomy2; import org.genesys2.server.model.genesys.Taxonomy2;
import org.genesys2.server.model.impl.Country; import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.FaoInstitute; import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.model.json.Api1Constants; import org.genesys2.server.model.json.Api1Constants;
import org.genesys2.server.persistence.AccessionHistoricRepository;
import org.genesys2.server.persistence.AccessionIdRepository;
import org.genesys2.server.persistence.AccessionRepository; import org.genesys2.server.persistence.AccessionRepository;
import org.genesys2.server.persistence.FaoInstituteRepository; import org.genesys2.server.persistence.FaoInstituteRepository;
import org.genesys2.server.service.CropService; import org.genesys2.server.service.CropService;
...@@ -91,6 +95,12 @@ public class AccessionUploader implements InitializingBean { ...@@ -91,6 +95,12 @@ public class AccessionUploader implements InitializingBean {
@Autowired @Autowired
private AccessionRepository accessionRepository; private AccessionRepository accessionRepository;
@Autowired
private AccessionIdRepository accessionIdRepository;
@Autowired
private AccessionHistoricRepository accessionHistoricRepository;
@Autowired @Autowired
private TaxonomyService taxonomyService; private TaxonomyService taxonomyService;
...@@ -677,6 +687,7 @@ public class AccessionUploader implements InitializingBean { ...@@ -677,6 +687,7 @@ public class AccessionUploader implements InitializingBean {
// Require matching genus for deletion // Require matching genus for deletion
List<Accession> existingAccessions = accessionRepository.find(true, identifiers); List<Accession> existingAccessions = accessionRepository.find(true, identifiers);
List<Accession> toRemove = new ArrayList<>(identifiers.size()); List<Accession> toRemove = new ArrayList<>(identifiers.size());
List<AccessionHistoric> deleted = new ArrayList<>();
for (int i = 0; i < identifiers.size(); i++) { for (int i = 0; i < identifiers.size(); i++) {
final AccessionHeaderJson deletion = identifiers.get(i); final AccessionHeaderJson deletion = identifiers.get(i);
...@@ -685,24 +696,48 @@ public class AccessionUploader implements InitializingBean { ...@@ -685,24 +696,48 @@ public class AccessionUploader implements InitializingBean {
AccessionOpResponse response; AccessionOpResponse response;
responses.add(response = new AccessionOpResponse(deletion.getHoldingInstitute(), deletion.getAccessionNumber(), deletion.getGenus())); responses.add(response = new AccessionOpResponse(deletion.getHoldingInstitute(), deletion.getAccessionNumber(), deletion.getGenus()));
Accession accession = existingAccessions.stream().filter(existing -> { Accession accession = existingAccessions.stream()
return (existing.getDoi() != null && existing.getDoi().equals(deletion.getDoi())) || (existing.getInstituteCode().equals(deletion.getHoldingInstitute()) && existing .filter(existing -> (
.getAccessionNumber().equals(deletion.getAccessionNumber()) && existing.getTaxonomy().getGenus().equals(deletion.getGenus())); existing.getInstituteCode().equals(deletion.getHoldingInstitute()) &&
}).findFirst().orElse(null); existing.getAccessionNumber().equals(deletion.getAccessionNumber()) &&
existing.getTaxonomy().getGenus().equals(deletion.getGenus())
)).findFirst().orElse(null);
if (accession == null) { if (accession == null) {
response.setResult(new UpsertResult(UpsertResult.Type.NOOP)); response.setResult(new UpsertResult(UpsertResult.Type.NOOP));
} else { } else {
LOG.trace("Deleting accession {}", accession); try {
toRemove.add(accession); if (deletion.doi != null || accession.getDoi() != null) {
response.setResult(new UpsertResult(UpsertResult.Type.DELETE).setUUID(accession.getUuid())); throw new InvalidApiUsageException("Accessions with doi cannot be deleted");
}
LOG.trace("Deleting accession {}", accession);
toRemove.add(accession);
response.setResult(new UpsertResult(UpsertResult.Type.DELETE).setUUID(accession.getUuid()));
AccessionHistoric hist = new AccessionHistoric();
SelfCopy.copy(accession, hist);
hist.setAccessionId(accessionIdRepository.findOne(accession.getId()));
deleted.add(hist);
} catch (InvalidApiUsageException e) {
if (LOG.isDebugEnabled()) {
LOG.error(e.getMessage(), e);
} else {
LOG.error(e.getMessage());
}
response.setError(e.getMessage());
}
} }
} }
if (!toRemove.isEmpty()) { if (!toRemove.isEmpty()) {
accessionRepository.delete(toRemove); accessionRepository.delete(toRemove);
LOG.trace("Deleted: {}", toRemove); LOG.trace("Done deleting: {}, now adding", toRemove);
accessionHistoricRepository.save(deleted);
} }
accessionCounter.recountInstitute(institute); accessionCounter.recountInstitute(institute);
return responses; return responses;
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
package org.genesys2.spring.config; package org.genesys2.spring.config;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.genesys.blocks.model.JsonViews; import org.genesys.blocks.model.JsonViews;
...@@ -58,7 +60,6 @@ import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module; ...@@ -58,7 +60,6 @@ import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module.Feature; import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module.Feature;
import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.ILock; import com.hazelcast.core.ILock;
import com.hazelcast.core.IQueue;
/** /**
* Elasticsearch config. * Elasticsearch config.
...@@ -78,6 +79,14 @@ public class ElasticsearchConfig { ...@@ -78,6 +79,14 @@ public class ElasticsearchConfig {
@Value("${elasticsearch.embedded.data}") @Value("${elasticsearch.embedded.data}")
private String embeddedDataHome; private String embeddedDataHome;
/**
* No-limits blocking queue for reindexing with ES
*/
@Bean
public BlockingQueue<ElasticReindex> elasticReindexQueue() {
return new LinkedBlockingQueue<>();
}
/** /**
* Elastic client. * Elastic client.
* *
...@@ -115,17 +124,6 @@ public class ElasticsearchConfig { ...@@ -115,17 +124,6 @@ public class ElasticsearchConfig {
return lock; return lock;
} }
/**
* Elastic reindex queue.
*
* @param hazelcast the hazelcast
* @return the i queue
*/
@Bean
public IQueue<ElasticReindex> elasticReindexQueue(final HazelcastInstance hazelcast) {
return hazelcast.getQueue("elasticsearchReindexQueue");
}
/** /**
* Elasticsearch service. * Elasticsearch service.
* *
......
...@@ -53,7 +53,6 @@ import com.hazelcast.core.HazelcastInstance; ...@@ -53,7 +53,6 @@ import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IExecutorService; import com.hazelcast.core.IExecutorService;
import com.hazelcast.core.ILock; import com.hazelcast.core.ILock;
import com.hazelcast.core.IMap; import com.hazelcast.core.IMap;
import com.hazelcast.core.IQueue;
import com.hazelcast.core.ManagedContext; import com.hazelcast.core.ManagedContext;
import com.hazelcast.hibernate.HazelcastCacheRegionFactory; import com.hazelcast.hibernate.HazelcastCacheRegionFactory;
import com.hazelcast.spring.cache.HazelcastCacheManager; import com.hazelcast.spring.cache.HazelcastCacheManager;
...@@ -388,28 +387,6 @@ public abstract class HazelcastConfig { ...@@ -388,28 +387,6 @@ public abstract class HazelcastConfig {
return x; return x;
} }
/**
* Elastic remove queue.
*
* @param hazelcast the hazelcast
* @return the i queue
*/
@Bean
public IQueue<Object> elasticRemoveQueue(final HazelcastInstance hazelcast) {
return hazelcast.getQueue("es-remove");
}
/**
* Elastic update queue.
*
* @param hazelcast the hazelcast
* @return the i queue
*/
@Bean
public IQueue<Object> elasticUpdateQueue(final HazelcastInstance hazelcast) {
return hazelcast.getQueue("es-update");
}
/** /**
* Distributed executor. * Distributed executor.
* *
......
...@@ -16,28 +16,68 @@ ...@@ -16,28 +16,68 @@
package org.genesys2.spring.config; package org.genesys2.spring.config;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;