[DOCU-2888] Documentation on automatic asset publication suggests broken configuration Created: 23/Oct/23  Updated: 31/Oct/23  Resolved: 31/Oct/23

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Dan Christiansen Assignee: Adrian Brooks
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Steps to reproduce

  1. Go to https://docs.magnolia-cms.com/product-docs/6.2/Modules/List-of-modules/Observation-module.html#_example_activating_assets_automatically
  2. Add an observer as suggested. (Note that the configuration is only listed as an image, which is rather annoying.)
  3. Go to the assets app.
  4. Create a folder.
  5. Publish the folder.
  6. Select the folder.
  7. Click the button to upload a Zip archive.
  8. Pick a Zip archive containing several images, not nested in a folder.
  9. Check “Extract here”
  10. Hit the upload button.
  11. Check the server logs.

.. Logs, screenshots, gifs...

Expected results

.. Justify non-trivial expectations with a link to a doc or a relevant discussion.

The publication should have succeeded, with no errors logged.

Actual results

One of the publications may fail due to a race condition, as multiple publications of the parent folder happen concurrently. The root cause, as seen in public, is an org.apache.jackrabbit.core.state.StaleItemStateException.

Workaround

Use the SpecifiedNodeTypeOnly listener, which also allows automatically publishing folders, while at it:

'autoActivateAssets':
  'active': 'true'
  'description': 'Automatically activate new assets & folders'
  'eventTypes': 'NODE_ADDED'
  'includeSubNodes': 'true'
  'path': '/'
  'repository': 'dam'
  'listener':
    'class': 'info.magnolia.module.observation.commands.SpecifiedNodeTypeOnlyEventListener'
    'includes':
      - 'mgnl:asset'
      - 'mgnl:folder'
    'command':
      'class': 'info.magnolia.publishing.command.PublicationCommand'
    'params':
      'repository': 'dam'

Development notes



 Comments   
Comment by Adrian Brooks [ 31/Oct/23 ]

I've added the additional configuration to the section and replaced the screenshot with tables for each example: https://docs.magnolia-cms.com/product-docs/6.2/Modules/List-of-modules/Observation-module.html#_activating_assets_automatically.

Generated at Mon Feb 12 01:31:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.