Hi John!

Are you aware of the Sling Background Servlets Engine (see
https://sling.apache.org/downloads.cgi /
https://issues.apache.org/jira/browse/SLING-550)?
There is little documentation on this, but IMO it might be what you need or
at least provide a good blueprint.

Kind regards,
Olaf

-----Original Message-----
From: John Logan [mailto:john.lo...@texture.com] 
Sent: Freitag, 17. März 2017 16:39
To: users@sling.apache.org
Subject: Question about performing background processing triggered by a
request.

Hi,

I was wondering whether it's possible for a resource request to invoke a
service that performs background processing, such that the worker thread
spawned by the service has a resource resolver and JCR session based on the
authentication info for the requesting user.

I tried using ResourceResolverFactory.getResourceResolver()
along with the AuthenticationInfo object from the request attributes, and
this yielded a LoginException.

Invoking requestedResource.getResourceResolver.clone(authInfo)
from inside the worker thread seems like an incorrect approach due to race
conditions.

Is there a way to create a resourceResolver for the user in this scenario,
or should I really be looking to the service authentication stuff for this?

Thanks!  John

Reply via email to