Expand my Community achievements bar.

Cant get references to a tag, when handle Resource/ADDED event under /etc/tags/default

Avatar

Level 4

We have implemented a Sling event handler to handle tags that are added to /etc/tags/default

When the handler gets the event that a tag was added, we are trying to get references to this tag by tagManager.find(tagID) 

The problem is that no references are returned. We can find the references only calling find(tagID) method with 10 seconds delay. Seems that some processes are not finished at this moment.

Calling a resourceResolver.refresh() before getting a tagManager does not help.

 

Can anybody suggest how to cope with this problem in a more elegant way?

4 Replies

Avatar

Level 9

Hi,

Quick question, and then I'm moving this to the Experience Manager topic where general platform issues are discussed and more people will see this.

This topic is more focused on the Communities capability.

The question is "What version of AEM are you using?"

If you're on AEM 6.1 or later, one thing to try is Setting Tag Permissions.

- JK

Avatar

Level 4

Thanks for you response,

Setting Tag permissions will not help because everything works but with some delay.

Avatar

Employee Advisor

Hi,

Obviously the tagManager.find() method uses a lucene index, which is updated asynchronously. This is a bit of unexpected though, but you can never assume that an element is immediately available via search after having it added to the repository.

Jörg

Avatar

Level 4

Thanks for your reply. We tried to delete this index and it didn't help