Hi,
System has custom transport handler that handles content transportation to the external system. This code was working on 5.5. Stopped working on the AEM 6.
It's created by implements TransportHandler
@Component(immediate = true, metatype = false)@Service(TransportHandler.class)
The problem we are facing at the moment is that public boolean canHandle(AgentConfig agentConfig) { method is not being invoked during the replication. Instead the default Transport handler is being invoked.
How can do I force CQ to use our custom TransportHandler implementation instead of the standard one ?
By running debug log level on com.day.cq.replication.impl.transport
We can see that ServiceTracker, has bound TransporHandler.
We can also see that the invoked class is still com.day.cq.replication.impl.transport.Http
Thanks,
Peter
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
This is a bug. Please file a DayCare issue referencing GRANITE-6117.
Alternatively (or as a short-term workaround), you can specify an alternate protocol in the URL. For example, if your URL was mycustom://localhost:4503/bin/receive?sling:authRequestLogin=1 (instead of http://localhost:4503/bin/receive?sling:authRequestLogin=1), your transport handler would always have the opportunity to handle the replication.
Regards,
Justin
Hi,
This is a bug. Please file a DayCare issue referencing GRANITE-6117.
Alternatively (or as a short-term workaround), you can specify an alternate protocol in the URL. For example, if your URL was mycustom://localhost:4503/bin/receive?sling:authRequestLogin=1 (instead of http://localhost:4503/bin/receive?sling:authRequestLogin=1), your transport handler would always have the opportunity to handle the replication.
Regards,
Justin
Hello Justin,
I can't thank you enough for your swift and effective solution to the GRANITE-6117 bug. Your recommendation to specify an alternate protocol in the URL worked like a charm, and I'm thrilled to share that my replication processes are now running seamlessly. This approach is a game-changer!
For anyone encountering a similar challenge, I highly recommend trying the alternate protocol method—it resolved my issue for my site https://www.shipvehicles.com/ perfectly.
By the way, if you ever need reliable vehicle shipping services, don't hesitate to check out how we excel. Your expertise has made a significant impact on my operations.
Best regards,
@smithTu We hope you found the AEM community valuable. We anticipate your return as either a learner or a contributor. The community benefits from SMEs like you. Please ask your AEM peers to join and contribute. Happy AEM learning!
Views
Replies
Total Likes
I am facing same issue.Though the above solution worked and the custom TransportHandler called , but the regular publish didn't work due to the protocol change.
I need to publish the content as well as push the content to Solr instance.
How can I achieve the same ?
Thanks & regards
Sumit
Hi Sumit,
You need to create your own custom agent.
There is an excellent guide about replication in Akamai[1], it's fairly similar to what you would do for Solr.
You can see code example[2]
[1] http://www.nateyolles.com/blog/2016/01/aem-akamai-custom-replication-agent
Hope it helps.
Regards,
Peter
Hi Peter,
Thanks for your reply.I was expecting the same. Will try the above.
Thanks & regards
Sumit
Do I need to write code for default replication agent too ?
Does not seem to be right approach. Can't we use default http handler for publish ?
Do I need to write code for default replication agent too ?
Does not seem to be right approach. Can't we use default http handler for publish ?
Hi Sumit,
Yes, absolutely you should not do changes to the OOTB content publishing mechanism from Author to the Publisher.
Given you can navigate to /miscadmin#/etc/replication/agents.author you will see Classic UI screen with the New button.
The idea here is that for your Solr config you would not use OOTB Replication Agent, but create your own Replication Agent(imagine calling it Solr Replication Agent).
Your own Solr Replication Agent can be created by extending the OOTB Replication Agent, which is just a standard CQ5 template/component with the configuration dialog.
Regards,
Peter
Hi Peter,
May be I could not explain it properly.I did create a solr replication agent. But with that and the custom transport handler deployed , only custom transporthandler is called ( for both default and solr replication agent) and the normal replication is not happening.Getting exception like below :
What am I mssing ?
Thanks & regards
Sumit
Hi Sumit,
As the exception tells you, there is a problem with your Reverse Replication.
Can you kindly check and un-tick the Reverse replication from your agent and try again?
Regards,
Peter
Hi Peter,
Tried disabling the reverse replication ,getting below now. If I remove the custom TransportHandler , normal publish happens as usual
org.apache.jackrabbit.oak.jcr.session.RefreshStrategy This session has been idle for 6 minutes and might be out of date. Consider using a fresh session or explicitly refresh the session.
java.lang.Exception: The session was created here:
at org.apache.jackrabbit.oak.jcr.session.RefreshStrategy$LogOnce.<init>(RefreshStrategy.java:169)
at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:260)
at com.adobe.granite.repository.impl.CRX3RepositoryImpl.login(CRX3RepositoryImpl.java:92)
at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:202)
at org.apache.jackrabbit.oak.jcr.session.SessionImpl.impersonate(SessionImpl.java:294)
at org.apache.sling.jcr.base.AbstractSlingRepository2.createServiceSession(AbstractSlingRepository2.java:187)
at org.apache.sling.jcr.base.AbstractSlingRepository2.loginService(AbstractSlingRepository2.java:339)
at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory.getResourceProviderInternal(JcrResourceProviderFactory.java:279)
at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory.getResourceProvider(JcrResourceProviderFactory.java:209)
at org.apache.sling.resourceresolver.impl.tree.ResourceProviderFactoryHandler.login(ResourceProviderFactoryHandler.java:172)
at org.apache.sling.resourceresolver.impl.tree.RootResourceProviderEntry.loginToRequiredFactories(RootResourceProviderEntry.java:95)
at org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.getResourceResolverInternal(CommonResourceResolverFactoryImpl.java:257)
at org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl.getServiceResourceResolver(ResourceResolverFactoryImpl.java:91)
at com.adobe.cq.commerce.impl.promotion.PromotionManagerImpl.activate(PromotionManagerImpl.java:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Thanks & regards
Sumit
My bad.For testing I was returning the canhandle() as true only.That was the root cause of the problem. Once I started it conditionally , it started working.
Thanks & regards
Sumit
Hi Summit,
Isn't that at WARNING level? Rather than an exception in the error.log file?Please post the top of the stack trace
Regards,
Opkar
Views
Likes
Replies