Higher level observation servicesPage edited by Bertrand DelacretazChanges (68)
Full ContentAnalyzing how we use observation in our Sling-based apps shows a number of recurring patterns, described in this page. Using JCR observation directly or Sling OSGi events does not make a big difference in the final results, but the implementations are very different. The commit hooks provided by http://jackrabbit.apache.org/oak/ provide yet another way of observing content changes, which might be more efficient or scalable in some cases. Being able to express these common observation patterns as higher-level services, if we can do that, would allow for switching the underlying implementation seamlessly, and would also help promote best practices in how we use events, by minimizing the amount of code to write at the application level. Observation usage patternsLet's list the frequent patterns that we see w.r.t observing changes in content. Cached ContentScenarioIn-memory data structures, or "compiled" versions of some content, are created when content changes. Typical usesConfigurations, CSS/_javascript_ processing, Sling installer, etc. TriggerChanges in content under specific paths (or path regexps), with optional restrictions on node types and/or event types. ActionClear an internal cache that is rebuilt the next time someone needs it. FrequencyContent changes are usually not very frequent, for the above typical uses. PerformanceSome latency between content changes and processing is usually not a problem. Potential issuesN requests coming just after clearing the cache should cause just one cache rebuild, not N. Content Export, Replication to Remote SystemsThis is similar to the Cached Content pattern. Content IngestionScenarioFiles that are dropped into the repository are parsed or processed, resulting in content changes and/or workflow events. Typical usesIngesting digital assets, parsing incoming email or other structured files. TriggerA file appears in a watched folder. ActionProcess the file, create the corresponding content, move the file to a "processed" or "rejected" folder. FrequencyDepends on the application. PerformanceSome latency is usually not a problem, but some applications need to process large number of files quickly. Potential issuesProcessing partially saved files too early can be a problem, depending on how files are added to the repository. Content Tree ReplicationScenarioTwo or more content trees are kept in sync, usually with customizable mappings and transformations. Typical usesManagement of federations of websites, which have some common parts and some specific parts. TriggerFine-grained detection of changes in a tree of content, based on paths, path regexps, node types or any other meaningful property. ActionReplicate the source tree to the target tree(s), optionally applying customizable content transformations. FrequencySource events might be quite frequent depending on authoring activity. PerformanceTree transformations might be costly and usually need to run as background jobs. Potential issuesAn explosion in the number of application-level and repository-level operations is possible depending on the shape of the content tree federation and on the frequency of source content changes. Aggregation of changesScenarioCollect a number of change events over time and/or for a content subtree, and provide an aggregated view. Typical usesDetect and act on changes to digital assets, without reacting to each and every small change. TriggerFine-grained detection of changes in a tree of content, based on paths, path regexps, node types or any other meaningful property. ActionStore and aggregate events and deliver the results on demand. FrequencyMight be quite frequent on a busy content tree. PerformanceAggregating events efficiently, as well as storing them until they're not needed anymore, can impact performance. Potential issuesMight create a noticeable load on the eventing/observation system, if listening to many detailed events. Consistency Checks and FixesScenarioWatch specific content subtrees for specific changes (nodes moved etc.) and react to them to avoid inconsistencies in the content. Typical usesAdapt paths that point to other pieces of content when content moves around. TriggerFine-grained detection of changes in a tree of content, based on paths, path regexps, node types or any other meaningful property. ActionModify content to keep it consistent FrequencyUsually not very frequent as that's mostly meant to handle edge cases. PerformanceA time window during which content can be seen as inconsistent is often unavoidable, keeping that window small is useful. Potential issuesContent must not be modified by JCR listeners, that should happen asynchronously if using JCR observation. Workflow/Job TriggerScenarioTrigger workflows and jobs when content changes. Typical usesThe unix print queue system is a good example, with folders named incoming, printing, done, rejected that store print job definitions. TriggerDetection of new content items in the incoming folder(s). ActionExecute the corresponding tasks and move the message nodes according to the results. FrequencyDepends on the application. PerformanceDepends on the application. Potential issuesLocking must be used if several job processors are competing for incoming jobs. Distributed processing of those jobs introduces cluster management requirements. Message QueueThis is very similar to the Workflow/Job trigger use case: messages are exchanged between producers and consumers.
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
- [CONF] Apache Sling > Higher level observation services confluence
