You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "David G." <da...@gmail.com> on 2012/06/01 22:35:42 UTC

Sling Events - By Path

Does sling provide any mechanism to create an EventHandler that listens only on specific paths?  

Im aware that you can check the event's resource's path within the event handler's handleEvent/process and return accordingly, but that doesn't suffice.

I am trying to have the same event type handled differently depending on the resource path that originated the event.

Also, if there any way to set precedence of an event handler for an event (service.ranking) and preventing the event from being handled by subsequent event handler last list on that topic?

Thanks 

-- 
David Gonzalez
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


Re: Sling Events - By Path

Posted by "David G." <da...@gmail.com>.
felix - thanks - the felix doc [1] was helpful. 

[1] http://felix.apache.org/site/apache-felix-event-admin.html

-- 
David Gonzalez
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Friday, June 1, 2012 at 5:29 PM, Felix Meschberger wrote:

> EventConstants.EVENT_FILTER 


Re: Sling Events - By Path

Posted by Felix Meschberger <fm...@adobe.com>.
Hi,

Am 01.06.2012 um 22:35 schrieb David G.:

> Does sling provide any mechanism to create an EventHandler that listens only on specific paths?  

Yes, you can define an event filter when you register the EventHandler, which allows you to limit the paths; for example

   props.put(EventConstants.EVENT_FILTER,
       "(path=/some/prefix/*)");

See the EventAdmin service spec in the OSGi Compendium for full details.

Regards
Felix

> 
> Im aware that you can check the event's resource's path within the event handler's handleEvent/process and return accordingly, but that doesn't suffice.
> 
> I am trying to have the same event type handled differently depending on the resource path that originated the event.
> 
> Also, if there any way to set precedence of an event handler for an event (service.ranking) and preventing the event from being handled by subsequent event handler last list on that topic?
> 
> Thanks 
> 
> -- 
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>