CSS Stylesheet |
---|
.deflist h4 { margin-top: 0; font-size:100%; font-weight:normal; font-style:italic; color:#888888; } .deflist h4 + p { margin-top: 0; } .deflist p { margin-left: 2em; } .deflist ul, .deflist ol { margin-left: 2em } |
Overview
Analyzing how we use observation in our Sling-based apps shows a number of recurring patterns, described on this page.
Cached Content
Div | ||
---|---|---|
| ||
ScenarioIn-memory data structures, or "compiled" versions of some content, are created when content changes. Typical usesConfigurations, CSS/javascript processing, Sling installer, etc. TriggerFine-grained detection of changes in a tree of content, based on paths, path regexps, node types or any other meaningful property. 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. Performance requirementsSome 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. Code using this pattern for configurations might rather take advantage of OSGi configurations managed by the Sling installer. Security considerationsLoading content in memory with an admin session will make it available to all users. Loading just the paths of the corresponding content items, and letting users retrieve the content themselves, avoids this problem. |
Content Export, Replication to Remote Systems
Div | ||
---|---|---|
| ||
ScenarioContent is exported as a file or pushed to a remote system when it changes. |
This is similar to the Cached Content pattern.
Content Ingestion
Div | ||
---|---|---|
| ||
ScenarioFiles 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. Performance requirementsSome 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. Security considerationsIngestion folders must be properly secured, and incoming content quarantined unless it can be proven safe. |
Content Tree Replication
Div | ||
---|---|---|
| ||
ScenarioTwo 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. Performance requirementsTree 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 changes
Div | ||
---|---|---|
| ||
ScenarioCollect 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. Performance requirementsAggregating 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. Security considerationsCareless aggregation might expose privileged data. |
Consistency Checks and Fixes
Div | ||
---|---|---|
| ||
ScenarioWatch 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. Performance requirementsA 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 Trigger
Div | ||
---|---|---|
| ||
ScenarioTrigger 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 job definition nodes according to the results. FrequencyDepends on the application. Performance requirementsDepends 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 Queue
Div | ||
---|---|---|
| ||
ScenarioImplement a simple message queue backed by a content repository subtree. |
This is very similar to the Workflow/Job trigger use case: messages are exchanged between producers and consumers, in the workflow/job trigger case the consumers are job processors.