When to use JCRUtility vs. ResourceResolverFactory for ResourceResolver

Avatar

Avatar

anthonyk3390753

Avatar

anthonyk3390753

anthonyk3390753

01-04-2018

Hi,

We are writing a Listener to handle the Publish event, we see that we can use JCRUtility.getResourceResolver() or use resourceResolverFactory.getResourceResolver(paramMap).

How do we decide under what scenarios one is better or appropriate than the other.

Thanks.

Replies

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

01-04-2018

The best way to work with the JCR is to create a system user and then use this code to get a Session:

resourceResolverFactory.getResourceResolver(paramMap)

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

01-04-2018

For those reading this thread and want more detail on creating a system user and the Sling Mapping Server to use resourceResolverFactory.getResourceResolver(paramMap) - see this article -- Adobe Experience Manager Help | Querying Adobe Experience Manager 6 data using the Sling getServiceR...