<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Event Handler Path property is throwing null in Adobe Experience Manager Discussions</title>
    <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/541917#M35505</link>
    <description>&lt;P&gt;&lt;LI-USER uid="14968223"&gt;&lt;/LI-USER&gt;&amp;nbsp;Thanks for the response. Just want to check how you validated in your local server. since it will trigger when content distribution is configured. I'm unable to configure in the local server.&lt;/P&gt;</description>
    <pubDate>Sun, 21 Aug 2022 12:36:33 GMT</pubDate>
    <dc:creator>Nishma</dc:creator>
    <dc:date>2022-08-21T12:36:33Z</dc:date>
    <item>
      <title>Event Handler Path property is throwing null</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/541699#M35503</link>
      <description>&lt;P&gt;Can you please to solve the null pointer exception in the handle event method.&lt;BR /&gt;Environment: AEMASCS&lt;/P&gt;
&lt;P&gt;Below is the sample code which will execute when the content is published in this path(/content/dam).&lt;BR /&gt;paths is throwing the null pointer exception.&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;SlingConstants&lt;/SPAN&gt;.&lt;SPAN&gt;PROPERTY_PATH = path&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;SPAN&gt;@Component(immediate = true, service = EventHandler.class, property = {&lt;BR /&gt;Constants.SERVICE_DESCRIPTION + "= This event handler listens the events on page activation",&lt;BR /&gt;EventConstants.EVENT_TOPIC + "=org/apache/sling/distribution/agent/package/distributed",&lt;BR /&gt;EventConstants.EVENT_FILTER + "=(&amp;amp;(distribution.paths=/content/dam/*) (|(distribution.type=ADD)(distribution.type=DELETE)))",&lt;BR /&gt;})&lt;BR /&gt;public class TestHandler implements EventHandler {&lt;BR /&gt;public void handleEvent(Event event) {&lt;BR /&gt;log.info("Testing on DEV...");&lt;BR /&gt;String[] paths = (String[]) event.getProperty(SlingConstants.PROPERTY_PATH);&lt;BR /&gt;}&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Please help me.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 09:32:18 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/541699#M35503</guid>
      <dc:creator>Nishma</dc:creator>
      <dc:date>2022-08-19T09:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Event Handler Path property is throwing null</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/541714#M35504</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;LI-USER uid="17522694"&gt;&lt;/LI-USER&gt;&amp;nbsp; I tried the same scenario in AEMaaCS and it worked for us. Please refer to below code snippet&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;@Component(immediate = &lt;SPAN&gt;true, &lt;/SPAN&gt;property = { &lt;SPAN&gt;"event.topics=org/apache/sling/distribution/importer/package/imported"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;      &lt;SPAN&gt;"event.filter=(|(distribution.type=ADD)(distribution.type=DELETE))" &lt;/SPAN&gt;})&lt;BR /&gt;&lt;SPAN&gt;public class &lt;/SPAN&gt;AkamaiSlingDistributionEventHandler &lt;SPAN&gt;implements &lt;/SPAN&gt;EventHandler {&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   public static final &lt;/SPAN&gt;String DISTRIBUTION_PATHS = &lt;SPAN&gt;"distribution.paths"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;   @Override&lt;BR /&gt;   &lt;SPAN&gt;public void &lt;/SPAN&gt;handleEvent(Event event) {&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      if &lt;/SPAN&gt;(event.getProperty(DISTRIBUTION_PATHS) != &lt;SPAN&gt;null&lt;/SPAN&gt;) {&lt;BR /&gt;         String[] pagePath = (String[]) event.getProperty(DISTRIBUTION_PATHS)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;      }&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;   }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 11:20:23 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/541714#M35504</guid>
      <dc:creator>Jagadeesh_Prakash</dc:creator>
      <dc:date>2022-08-19T11:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Event Handler Path property is throwing null</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/541917#M35505</link>
      <description>&lt;P&gt;&lt;LI-USER uid="14968223"&gt;&lt;/LI-USER&gt;&amp;nbsp;Thanks for the response. Just want to check how you validated in your local server. since it will trigger when content distribution is configured. I'm unable to configure in the local server.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 12:36:33 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/541917#M35505</guid>
      <dc:creator>Nishma</dc:creator>
      <dc:date>2022-08-21T12:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Event Handler Path property is throwing null</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542015#M35554</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;LI-USER uid="17522694"&gt;&lt;/LI-USER&gt;&amp;nbsp;There is no special configurations needed to do in local to test it. It should get triggered when ever there is any page or asset replication is done.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Or you can test in cloud dev environment as well&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 10:40:36 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542015#M35554</guid>
      <dc:creator>Jagadeesh_Prakash</dc:creator>
      <dc:date>2022-08-22T10:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Event Handler Path property is throwing null</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542035#M35558</link>
      <description>&lt;P&gt;&lt;LI-USER uid="14968223"&gt;&lt;/LI-USER&gt;&amp;nbsp;when ever we are publishing the assert sling content distribution will trigger(that setup i was unable to do in local). so i tried in dev environment by publishing the assert but still it is not triggering. Please suggest me. I got struck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;@Component(immediate = true, service = EventHandler.class, property = {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Constants.SERVICE_DESCRIPTION + "= This event handler listens the events on page activation",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;EventConstants.EVENT_TOPIC + "=org/apache/sling/distribution/importer/package/imported",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;EventConstants.EVENT_FILTER + "=(&amp;amp;(distribution.paths=/content/dam/test/*) (|(distribution.type=ADD)(distribution.type=DELETE)))",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;})&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public class TestHandler implements EventHandler {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private static final Logger log = LoggerFactory.getLogger(TestHandler.class);&lt;/SPAN&gt;&lt;SPAN&gt;@Override&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public void handleEvent(Event event) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="c-link" tabindex="-1" href="http://log.info/" target="_blank" rel="noopener noreferrer" data-stringify-link="http://log.info" data-sk="tooltip_parent" data-remove-tab-index="true"&gt;log.info&lt;/A&gt;&lt;SPAN&gt;("Testing on DEV...");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 12:53:52 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542035#M35558</guid>
      <dc:creator>Nishma</dc:creator>
      <dc:date>2022-08-22T12:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Event Handler Path property is throwing null</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542046#M35559</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;LI-USER uid="17522694"&gt;&lt;/LI-USER&gt;&amp;nbsp;Please check the logs in publisher and not in the author.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 13:31:59 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542046#M35559</guid>
      <dc:creator>Jagadeesh_Prakash</dc:creator>
      <dc:date>2022-08-22T13:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Event Handler Path property is throwing null</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542048#M35560</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;LI-USER uid="17522694"&gt;&lt;/LI-USER&gt;&amp;nbsp;If still you are facing issue, try below one. But i recommand the previous post which worked for me and below code was working in local but not in the AEMcs environment.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Note: I removed some code. Please improvise and try according to your requirement&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;@Component&lt;/SPAN&gt;(&lt;BR /&gt;        service = EventHandler.&lt;SPAN&gt;class, &lt;/SPAN&gt;configurationPolicy = ConfigurationPolicy.&lt;SPAN&gt;REQUIRE&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        property = {EventConstants.&lt;SPAN&gt;EVENT_TOPIC&lt;/SPAN&gt;+&lt;SPAN&gt;"=" &lt;/SPAN&gt;+ ReplicationAction.&lt;SPAN&gt;EVENT_TOPIC&lt;/SPAN&gt;})&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public class &lt;/SPAN&gt;ReplicationListenerOnAuthor &lt;SPAN&gt;implements &lt;/SPAN&gt;Runnable&lt;SPAN&gt;, &lt;/SPAN&gt;EventHandler {&lt;BR /&gt;&lt;SPAN&gt;    private &lt;/SPAN&gt;BundleContext &lt;SPAN&gt;bundleContext&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;@Override&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;public void &lt;/SPAN&gt;&lt;SPAN&gt;handleEvent&lt;/SPAN&gt;(Event event) {&lt;BR /&gt;&lt;SPAN&gt;        if &lt;/SPAN&gt;(isAuthor()) {&lt;BR /&gt;            &lt;SPAN&gt;final &lt;/SPAN&gt;ReplicationActionType replicationType = ReplicationAction.&lt;SPAN&gt;fromEvent&lt;/SPAN&gt;(event).getType()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;            if &lt;/SPAN&gt;(replicationType == ReplicationActionType.&lt;SPAN&gt;ACTIVATE &lt;/SPAN&gt;|| replicationType == ReplicationActionType.&lt;SPAN&gt;DEACTIVATE &lt;/SPAN&gt;|| replicationType == ReplicationActionType.&lt;SPAN&gt;DELETE&lt;/SPAN&gt;)&lt;BR /&gt;            {      &lt;SPAN&gt;// service call here&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;                   &lt;BR /&gt;&lt;/SPAN&gt;            }&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;@Override&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;public void &lt;/SPAN&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;() {&lt;BR /&gt;        &lt;SPAN&gt;log&lt;/SPAN&gt;.debug(&lt;SPAN&gt;"{} Running..."&lt;/SPAN&gt;&lt;SPAN&gt;, this&lt;/SPAN&gt;.getClass().getName())&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;@Activate&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;protected void &lt;/SPAN&gt;&lt;SPAN&gt;activate&lt;/SPAN&gt;(ComponentContext componentContext) {&lt;BR /&gt;        &lt;SPAN&gt;bundleContext &lt;/SPAN&gt;= componentContext.getBundleContext()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;@Deactivate&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;protected void &lt;/SPAN&gt;&lt;SPAN&gt;deactivate&lt;/SPAN&gt;() {&lt;BR /&gt;        &lt;SPAN&gt;bundleContext &lt;/SPAN&gt;= &lt;SPAN&gt;null;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 13:40:30 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/event-handler-path-property-is-throwing-null/m-p/542048#M35560</guid>
      <dc:creator>Jagadeesh_Prakash</dc:creator>
      <dc:date>2022-08-22T13:40:30Z</dc:date>
    </item>
  </channel>
</rss>

