AEM version: 6.5.14 with Java 11
Following is my custom replication event handler class
(service = EventHandler.class, configurationPolicy = ConfigurationPolicy.REQUIRE,
immediate = true, property = {
Constants.SERVICE_DESCRIPTION + "=replication description",
EventConstants.EVENT_TOPIC + "=" + ReplicationAction.EVENT_TOPIC})
public class ReplicationHandler implements EventHandler {
some logs...
extract ReplicationAction object from event.
adding the action as a job to a particular Topic using JobManager.
}
When replication events triggers, some logs are printed and some code is executed. The problem that I'm facing is that this works inconsistently.
Sometimes the code doesn't execute and the logs are also not printed.
The resources are replicated with no errors.
Has anyone faced this kind of issue before?
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Possibility is, the event handler is taking too much time to execute. If this time goes beyond 5 secs which is default TimeOut value, then the handler would be blacklisted and would never execute.
Hence, please consider using Sling Jobs or Job Consumer which will guarantee execution and does not follow 5 sec Timeout rule
Please look into below link for more info:https://felix.apache.org/documentation/subprojects/apache-felix-event-admin.html
@krati_garg Thanks a lot for quick and a good resolution.
I have updated the code in question to give more information regarding my situation.
Inside the handler we are doing only two things
This hardly takes us 5 lines of code
You mentioned that replication is successful, so it cannot be an issue of blocked Replication Queues.
Also, as per above Code Snippet, you must be using Job Consumer.
Can you refer below Code Snippet, and see if you haven't missed anything. Also, please put loggers inside Job consumer, logging status of execution. This would help us troubleshooting.
https://www.linkedin.com/pulse/aem-how-write-sling-jobs-aem-veena-vikraman/
We are logging in the consumers as well which are again not printed since replication handler is not handing over jobs to them.
and as per your link I have checked our consumers they are written correctly.
The first line in the event handler as well as the consumer is us logging.
whenever the issue occurs no logs from event handler as well as consumer is found in the log file.
This may be due to the parallel jobs running and not completed, can you change/increase the configuration for parallel jobs, this may give more time for job to complete.
Above image show the config details for the same.
Hope this helps!!!
Views
Likes
Replies