Package io.jmix.search.index.queue.impl
Class JpaIndexingQueueManager
java.lang.Object
io.jmix.search.index.queue.impl.JpaIndexingQueueManager
- All Implemented Interfaces:
- IndexingQueueManager
@Component("search_JpaIndexingQueueManager")
public class JpaIndexingQueueManager
extends Object
implements IndexingQueueManager
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classAnalyzes collection ofIndexingQueueItem, determines unique entity ids and splits them among two disjoint groups: for index and for delete.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected SystemAuthenticatorprotected UnconstrainedDataManagerprotected EnqueueingSessionManagerprotected EntityIdsLoaderProviderprotected EntityIndexerprotected IdSerializationprotected IndexConfigurationManagerprotected IndexStateRegistryprotected IndexingLockerprotected Metadataprotected MetadataToolsprotected SearchPropertiesprotected StoreAwareLocator
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected LoadContext<IndexingQueueItem>createDequeueLoadContext(List<String> unavailableEntities, int batchSize) protected IndexingQueueItemcreateQueueItem(MetaClass metaClass, String entityId, IndexingOperation operation) protected IndexingQueueItemcreateQueueItem(String entityName, String entityId, IndexingOperation operation) intRemoves all queue items.intemptyQueue(String entityName) Removes all queue items related to provided entity.protected intenqueue(Collection<IndexingQueueItem> queueItems) protected intenqueue(Collection<Object> entityInstances, IndexingOperation operation) protected intenqueueByIds(Collection<Id<?>> entityIds, IndexingOperation operation) intenqueueDelete(Object entityInstance) Sends provided entity instance to indexing queue in order to delete it from index.intenqueueDeleteByEntityId(Id<?> entityId) Sends entity instance to indexing queue by provided ID in order to delete it from index.intenqueueDeleteCollection(Collection<Object> entityInstances) Sends provided entity instances to indexing queue in order to delete them from index.intenqueueDeleteCollectionByEntityIds(Collection<Id<?>> entityIds) Sends entity instances to indexing queue by provided IDs in order to delete them from index.intenqueueIndex(Object entityInstance) Sends provided entity instance to indexing queue in order to store it to index.intSynchronously sends all instances of all index-configured entities to indexing queue.intenqueueIndexAll(String entityName) Synchronously sends all instances of provided entity to indexing queue.protected intenqueueIndexAll(String entityName, int batchSize) intenqueueIndexByEntityId(Id<?> entityId) Sends entity instance to indexing queue by provided ID in order to store it to index.intenqueueIndexCollection(Collection<Object> entityInstances) Sends provided entity instances to indexing queue in order to store them to index.intenqueueIndexCollectionByEntityIds(Collection<Id<?>> entityIds) Sends entity instances to indexing queue by provided IDs in order to store them to index.protected intenqueueNextBatchInternal(EnqueueingSession session, int batchSize) Gets entity names of all existing enqueueing sessions.protected Map<IndexingOperation,Map<Id<?>, List<IndexingQueueItem>>> groupQueueItems(Collection<IndexingQueueItem> queueItems) protected List<IndexingQueueItem>handleIndexResult(IndexResult indexResult, Map<Id<?>, List<IndexingQueueItem>> itemsGroup) voidInitializes async enqueueing session for all indexed entities.booleaninitAsyncEnqueueIndexAll(String entityName) Initializes async enqueueing session for provided entity.protected List<?>loadRawIds(MetaClass metaClass) protected intprocessEnqueueingSession(EnqueueingSession session, int batchSize) intprocessEnqueueingSession(String entityName) Processes enqueueing session for provided entity - one batch (with default size) of entity instances will be enqueued.intprocessEnqueueingSession(String entityName, int batchSize) Processes enqueueing session for provided entity - one batch (with provided size) of entity instances will be enqueued.intRetrieves items from indexing queue and processes them - store/remove related documents in index.intprocessEntireQueue(int batchSize) Retrieves items from indexing queue and processes them - store/remove related documents in index.intRetrieves next batch of items from indexing queue and processes them - store/remove related documents in index.intprocessNextBatch(int batchSize) Retrieves next batch of items from indexing queue and processes them - store/remove related documents in index.intProcesses next available enqueueing session - one batch (with default size) of entity instances will be enqueued.intprocessNextEnqueueingSession(int batchSize) Processes next available enqueueing session - one batch (with provided size) of entity instances will be enqueued.protected intprocessQueue(int batchSize, boolean processEntireQueue) protected List<IndexingQueueItem>processQueueItems(List<IndexingQueueItem> queueItems) protected List<IndexingQueueItem>processQueueItemsGroup(Map<Id<?>, List<IndexingQueueItem>> itemsGroup, Function<Collection<Id<?>>, IndexResult> processingFunction) protected intprocessRawIds(List<?> rawIds, MetaClass metaClass, int batchSize) voidResumes all previously suspended enqueueing sessions.booleanresumeAsyncEnqueueIndexAll(String entityName) Resumes previously suspended enqueueing session for provided entity.voidSuspends all enqueueing sessions.booleansuspendAsyncEnqueueIndexAll(String entityName) Suspends enqueueing session for provided entity.voidTerminates all enqueueing sessions.booleanterminateAsyncEnqueueIndexAll(String entityName) Terminates enqueueing session for provided entity.
- 
Field Details- 
dataManager
- 
metadata
- 
metadataTools
- 
entityIndexer
- 
storeAwareLocator
- 
indexConfigurationManager
- 
idSerialization
- 
authenticator
- 
locker
- 
searchProperties
- 
indexStateRegistry
- 
enqueueingSessionManager
- 
entityIdsLoaderProvider
 
- 
- 
Constructor Details- 
JpaIndexingQueueManagerpublic JpaIndexingQueueManager()
 
- 
- 
Method Details- 
emptyQueuepublic int emptyQueue()Description copied from interface:IndexingQueueManagerRemoves all queue items.- Specified by:
- emptyQueuein interface- IndexingQueueManager
- Returns:
- amount of deleted items
 
- 
emptyQueueDescription copied from interface:IndexingQueueManagerRemoves all queue items related to provided entity.- Specified by:
- emptyQueuein interface- IndexingQueueManager
- Parameters:
- entityName- entity
- Returns:
- amount of deleted items
 
- 
enqueueIndexDescription copied from interface:IndexingQueueManagerSends provided entity instance to indexing queue in order to store it to index.- Specified by:
- enqueueIndexin interface- IndexingQueueManager
- Parameters:
- entityInstance- instance
- Returns:
- amount of enqueued instances
 
- 
enqueueIndexCollectionDescription copied from interface:IndexingQueueManagerSends provided entity instances to indexing queue in order to store them to index.- Specified by:
- enqueueIndexCollectionin interface- IndexingQueueManager
- Parameters:
- entityInstances- instances
- Returns:
- amount of enqueued instances
 
- 
enqueueIndexByEntityIdDescription copied from interface:IndexingQueueManagerSends entity instance to indexing queue by provided ID in order to store it to index.- Specified by:
- enqueueIndexByEntityIdin interface- IndexingQueueManager
- Parameters:
- entityId- ID of entity instance
- Returns:
- amount of enqueued instances
 
- 
enqueueIndexCollectionByEntityIdsDescription copied from interface:IndexingQueueManagerSends entity instances to indexing queue by provided IDs in order to store them to index.- Specified by:
- enqueueIndexCollectionByEntityIdsin interface- IndexingQueueManager
- Parameters:
- entityIds- IDs of entity instances
- Returns:
- amount of enqueued instances
 
- 
enqueueIndexAllpublic int enqueueIndexAll()Description copied from interface:IndexingQueueManagerSynchronously sends all instances of all index-configured entities to indexing queue.Don't use it on a huge amount of data - all ids (per entity) will be kept in memory during this process. Use IndexingQueueManager.initAsyncEnqueueIndexAll()methods instead.- Specified by:
- enqueueIndexAllin interface- IndexingQueueManager
- Returns:
- amount of enqueued instances
 
- 
enqueueIndexAllDescription copied from interface:IndexingQueueManagerSynchronously sends all instances of provided entity to indexing queue.Don't use it on a huge amount of data - all ids will be kept in memory during this process. Use IndexingQueueManager.initAsyncEnqueueIndexAll()methods instead.- Specified by:
- enqueueIndexAllin interface- IndexingQueueManager
- Parameters:
- entityName- entity name
- Returns:
- amount of enqueued instances
 
- 
getEntityNamesOfEnqueueingSessionsDescription copied from interface:IndexingQueueManagerGets entity names of all existing enqueueing sessions.- Specified by:
- getEntityNamesOfEnqueueingSessionsin interface- IndexingQueueManager
- Returns:
- list of entity names
 
- 
initAsyncEnqueueIndexAllpublic void initAsyncEnqueueIndexAll()Description copied from interface:IndexingQueueManagerInitializes async enqueueing session for all indexed entities.- Specified by:
- initAsyncEnqueueIndexAllin interface- IndexingQueueManager
 
- 
initAsyncEnqueueIndexAllDescription copied from interface:IndexingQueueManagerInitializes async enqueueing session for provided entity. Existing session will be removed and created again.- Specified by:
- initAsyncEnqueueIndexAllin interface- IndexingQueueManager
- Parameters:
- entityName- entity name
- Returns:
- true if operation was successfully performed, false otherwise
 
- 
suspendAsyncEnqueueIndexAllpublic void suspendAsyncEnqueueIndexAll()Description copied from interface:IndexingQueueManagerSuspends all enqueueing sessions. Suspended sessions are ignored during session processing. Session can be resumed byIndexingQueueManager.resumeAsyncEnqueueIndexAll()- Specified by:
- suspendAsyncEnqueueIndexAllin interface- IndexingQueueManager
 
- 
suspendAsyncEnqueueIndexAllDescription copied from interface:IndexingQueueManagerSuspends enqueueing session for provided entity. Suspended sessions are ignored during session processing. Session can be resumed byIndexingQueueManager.resumeAsyncEnqueueIndexAll()- Specified by:
- suspendAsyncEnqueueIndexAllin interface- IndexingQueueManager
- Parameters:
- entityName- entity name
- Returns:
- true if operation was successfully performed, false otherwise
 
- 
resumeAsyncEnqueueIndexAllpublic void resumeAsyncEnqueueIndexAll()Description copied from interface:IndexingQueueManagerResumes all previously suspended enqueueing sessions.- Specified by:
- resumeAsyncEnqueueIndexAllin interface- IndexingQueueManager
 
- 
resumeAsyncEnqueueIndexAllDescription copied from interface:IndexingQueueManagerResumes previously suspended enqueueing session for provided entity.- Specified by:
- resumeAsyncEnqueueIndexAllin interface- IndexingQueueManager
- Parameters:
- entityName- entity name
- Returns:
- true if operation was successfully performed, false otherwise
 
- 
terminateAsyncEnqueueIndexAllpublic void terminateAsyncEnqueueIndexAll()Description copied from interface:IndexingQueueManagerTerminates all enqueueing sessions.- Specified by:
- terminateAsyncEnqueueIndexAllin interface- IndexingQueueManager
 
- 
terminateAsyncEnqueueIndexAllDescription copied from interface:IndexingQueueManagerTerminates enqueueing session for provided entity.- Specified by:
- terminateAsyncEnqueueIndexAllin interface- IndexingQueueManager
- Parameters:
- entityName- entity name
- Returns:
- true if operation was successfully performed, false otherwise
 
- 
processNextEnqueueingSessionpublic int processNextEnqueueingSession()Description copied from interface:IndexingQueueManagerProcesses next available enqueueing session - one batch (with default size) of entity instances will be enqueued.- Specified by:
- processNextEnqueueingSessionin interface- IndexingQueueManager
- Returns:
- amount of processed entity instances
 
- 
processNextEnqueueingSessionpublic int processNextEnqueueingSession(int batchSize) Description copied from interface:IndexingQueueManagerProcesses next available enqueueing session - one batch (with provided size) of entity instances will be enqueued.- Specified by:
- processNextEnqueueingSessionin interface- IndexingQueueManager
- Parameters:
- batchSize- batch size
- Returns:
- amount of processed entity instances
 
- 
processEnqueueingSessionDescription copied from interface:IndexingQueueManagerProcesses enqueueing session for provided entity - one batch (with default size) of entity instances will be enqueued.- Specified by:
- processEnqueueingSessionin interface- IndexingQueueManager
- Parameters:
- entityName- entity name
- Returns:
- amount of processed entity instances
 
- 
processEnqueueingSessionDescription copied from interface:IndexingQueueManagerProcesses enqueueing session for provided entity - one batch (with provided size) of entity instances will be enqueued.- Specified by:
- processEnqueueingSessionin interface- IndexingQueueManager
- Parameters:
- entityName- entity name
- batchSize- batch size
- Returns:
- amount of processed entity instances
 
- 
enqueueDeleteDescription copied from interface:IndexingQueueManagerSends provided entity instance to indexing queue in order to delete it from index.- Specified by:
- enqueueDeletein interface- IndexingQueueManager
- Parameters:
- entityInstance- instance
- Returns:
- amount of enqueued instances
 
- 
enqueueDeleteCollectionDescription copied from interface:IndexingQueueManagerSends provided entity instances to indexing queue in order to delete them from index.- Specified by:
- enqueueDeleteCollectionin interface- IndexingQueueManager
- Parameters:
- entityInstances- instances
- Returns:
- amount of enqueued instances
 
- 
enqueueDeleteByEntityIdDescription copied from interface:IndexingQueueManagerSends entity instance to indexing queue by provided ID in order to delete it from index.- Specified by:
- enqueueDeleteByEntityIdin interface- IndexingQueueManager
- Parameters:
- entityId- ID of entity instance
- Returns:
- amount of enqueued instances
 
- 
enqueueDeleteCollectionByEntityIdsDescription copied from interface:IndexingQueueManagerSends entity instances to indexing queue by provided IDs in order to delete them from index.- Specified by:
- enqueueDeleteCollectionByEntityIdsin interface- IndexingQueueManager
- Parameters:
- entityIds- IDs of entity instances
- Returns:
- amount of enqueued instances
 
- 
processNextBatchpublic int processNextBatch()Description copied from interface:IndexingQueueManagerRetrieves next batch of items from indexing queue and processes them - store/remove related documents in index.- Specified by:
- processNextBatchin interface- IndexingQueueManager
- Returns:
- amount of processed queue items
 
- 
processNextBatchpublic int processNextBatch(int batchSize) Description copied from interface:IndexingQueueManagerRetrieves next batch of items from indexing queue and processes them - store/remove related documents in index.- Specified by:
- processNextBatchin interface- IndexingQueueManager
- Parameters:
- batchSize- amount of queue items to process
- Returns:
- amount of processed queue items
 
- 
processEntireQueuepublic int processEntireQueue()Description copied from interface:IndexingQueueManagerRetrieves items from indexing queue and processes them - store/remove related documents in index.- Specified by:
- processEntireQueuein interface- IndexingQueueManager
- Returns:
- amount of processed queue items
 
- 
processEntireQueuepublic int processEntireQueue(int batchSize) Description copied from interface:IndexingQueueManagerRetrieves items from indexing queue and processes them - store/remove related documents in index.- Specified by:
- processEntireQueuein interface- IndexingQueueManager
- Parameters:
- batchSize- amount of queue items to process within single batch
- Returns:
- amount of processed queue items
 
- 
processEnqueueingSession
- 
enqueueNextBatchInternal
- 
enqueueIndexAll
- 
loadRawIds
- 
processRawIds
- 
processQueueprotected int processQueue(int batchSize, boolean processEntireQueue) 
- 
createDequeueLoadContextprotected LoadContext<IndexingQueueItem> createDequeueLoadContext(List<String> unavailableEntities, int batchSize) 
- 
processQueueItems
- 
processQueueItemsGroupprotected List<IndexingQueueItem> processQueueItemsGroup(Map<Id<?>, List<IndexingQueueItem>> itemsGroup, Function<Collection<Id<?>>, IndexResult> processingFunction) 
- 
handleIndexResultprotected List<IndexingQueueItem> handleIndexResult(IndexResult indexResult, Map<Id<?>, List<IndexingQueueItem>> itemsGroup) 
- 
groupQueueItemsprotected Map<IndexingOperation,Map<Id<?>, groupQueueItemsList<IndexingQueueItem>>> (Collection<IndexingQueueItem> queueItems) 
- 
enqueue
- 
enqueueByIds
- 
enqueue
- 
createQueueItemprotected IndexingQueueItem createQueueItem(MetaClass metaClass, String entityId, IndexingOperation operation) 
- 
createQueueItemprotected IndexingQueueItem createQueueItem(String entityName, String entityId, IndexingOperation operation) 
 
-