ResourceChange in 6.3

August 24, 2017    6.3 aem sling


API ‘BREAKING’ changes

I’d like to share some interesting thing I have faced when we migrated form AEM 6.2 to 6.3.

There is several options how to observe changes in AEM:

  • EventListener - low lvl
  • EventHandler - high lvl
  • ResourceChangeListener - high lvl

I have used ResourceChangeListener because it was quite easy to get changed/added/removed properties from ResourceChange,BUT in AEM 6.2 they were

    /**
     * Optional information about changed properties.
     * @return The set of changed property names. For external events or
     *         resource provider events {@code null} is returned.
     */
    public @CheckForNull Set<String> getChangedPropertyNames() {
        return this.changedPropertyNames;
    }

    /**
     * Optional information about added properties.
     * @return The set of changed property names. For external events or
     *         resource provider events {@code null} is returned.
     */
    public @CheckForNull Set<String> getAddedPropertyNames() {
        return this.addedPropertyNames;
    }

    /**
     * Optional information about removed properties.
     * @return The set of changed property names. For external events or
     *         resource provider events {@code null} is returned.
     */
    public @CheckForNull Set<String> getRemovedPropertyNames() {
        return this.removedPropertyNames;
    }

So we could hope for these props be presented, but if you will look at javadoc for AEM 6.3 you will see that

Set<String>	getAddedPropertyNames()
Deprecated. 
As there is no guarantee that this information is contained in the change event, this should not be used anymore.

Set<String>	getChangedPropertyNames()
Deprecated. 
As there is no guarantee that this information is contained in the change event, this should not be used anymore.

Set<String>	getRemovedPropertyNames()
Deprecated. 
As there is no guarantee that this information is contained in the change event, this should not be used anymore.

It was so unexpected. We have broken functionality, it is only our problem i guess, that we were not prepared for this.

But I hope that this article helped you. Guys form aem-tech.slack.com helped me a lot, so thanks to them.

Original Sling ticket for this deprecation here

And really helpful change set for api in 6.3 is here




comments powered by Disqus