Hello Everyone,
We were using sling distribution API in AEM 6.3. Now when we try upgrading to AEM 6.5.2 below imports are not resolving. Did someone face this issue? if yes could you please share your findings and inputs to come out from this situation. Is there any alternative solution for this ?
import org.apache.sling.distribution.DistributionRequest;
import org.apache.sling.distribution.DistributionRequestType;
import org.apache.sling.distribution.DistributionResponse;
import org.apache.sling.distribution.Distributor;
import org.apache.sling.distribution.SimpleDistributionRequest;
Views
Replies
Total Likes
I believe there were some changes done internally to hide the distribution core bundle(Internal ticket - GRANITE-20094). Can you try the following:
Here the package name should be the one that will be using the "org.apache.sling.distribution" API.
Views
Replies
Total Likes
Hi @jbrar
At first I am not able to run the build also. I am getting compilation error because of those imports. So wouldn't be able to try your workaround.
Any other thoughts here??
Views
Replies
Total Likes
These packages are not supposed to be used by downstream consumers (= customers) directly, but they should be used by Adobe product bundles. That's enforced during runtime.
That fact, that it was visible in 6.5 GA release, was by mistake, and it has been corrected later.
Why do you need to access these java packages directly?
Views
Replies
Total Likes
Hi ,
we are using this to sync user profiles. FYI below is the similar parts of code snippets how we used distributor.
1)
@Component(
service = ResourceChangeListener.class,
property = {
ResourceChangeListener.PATHS + "=glob:/home/users/**/profile",
ResourceChangeListener.CHANGES + "=ADDED",
ResourceChangeListener.CHANGES + "=CHANGED"
}
)
2)@Reference
private Distributor distributor;
3)
public void onChange(@Nonnull List<ResourceChange> changes) {
if (publish) {
for (final ResourceChange change : changes) {
ResourceResolver resolver = null;
try {
resolver = resourceResolverFactory
.getServiceResourceResolver(OsgiUtils.getAuthInfoMap(UserDistributionEventHandler.class));
DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, change.getPath());
DistributionResponse response = distributor.distribute("user-agent", resolver, request);
log.debug(response.getMessage() + " - " + response.getState());
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
if (resolver != null && resolver.isLive()) {
resolver.close();
}
}
}
}
}
In 6.3 it was available in uber jar itself. now in 6.5/6.5.2 its no longer available. Even after adding below dependency imports related to sling distribution is resolved but bundle is in installed state saying missing requirement [**bundle name**** [615](R 615.0)] osgi.wiring.package; (&(osgi.wiring.package=org.apache.sling.distribution)(version>=0.3.0)(!(version>=1.0.0)))
<dependency>
<artifactId>org.apache.sling.distribution.api</artifactId>
<version>0.3.0</version>
<groupId>org.apache.sling</groupId>
<scope>provided</scope>
</dependency>
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies