Class RecentlyProcessedFilter
- All Implemented Interfaces:
org.alfresco.event.sdk.handling.filter.EventFilter
This filter prevents repeated processing of the same node event within a specified duration, helping to avoid duplicate processing and reduce unnecessary load on the system. A node ID is tracked in a thread-safe, static map upon successful test evaluation. Further events for that node are rejected until the threshold expires.
The time threshold is provided when instantiating the filter via the of(long)
factory method.
The test(RepoEvent)
method checks if the node associated with the event has been processed
recently, returning true
and updating the internal tracking map if the node is eligible,
or returning false
otherwise.
The filter periodically cleans its tracking map to remove expired node entries using the
cleanRecentlyProcessedNodes()
scheduled method, minimizing memory usage.
Thread safety is ensured by the use of a ConcurrentHashMap
.
Logging is provided for skipped and removed nodes for debugging and traceability.
This filter is typically used in event processing chains to enforce de-duplication logic on node events.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
static RecentlyProcessedFilter
of
(long threshold) boolean
test
(org.alfresco.repo.event.v1.model.RepoEvent<org.alfresco.repo.event.v1.model.DataAttributes<org.alfresco.repo.event.v1.model.Resource>> repoEvent) Methods inherited from class org.alfresco.event.sdk.handling.filter.AbstractEventFilter
hasAspectAfter, hasAspectBefore, hasPropertyAfter, hasPropertyBefore, hasResourceBefore, isAssocEvent, isContentEvent, isEventWellFormed, isNodeEvent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.alfresco.event.sdk.handling.filter.EventFilter
and, negate, or
-
Method Details
-
of
-
test
public boolean test(org.alfresco.repo.event.v1.model.RepoEvent<org.alfresco.repo.event.v1.model.DataAttributes<org.alfresco.repo.event.v1.model.Resource>> repoEvent) -
cleanRecentlyProcessedNodes
@Scheduled(fixedDelay=300000L) public void cleanRecentlyProcessedNodes()
-