[xwiki-dev] [Proposal] New notification implementation
Vincent Massol
vincent at massol.net
Sat Jul 21 09:21:31 CEST 2007
On Jul 21, 2007, at 5:46 AM, Asiri Rathnayake wrote:
> Thanks. I learnt few things about how to make a proper patch too
> (should have done before), my patches are bit too crappy.
>
> I was thinking, can we use this mechanism for purposes like
> notifying (send an email or something like that) to the original
> author of the document when the document is changed ? Or is some
> other mechanism there for this purpose ?
It's a generic purpose mechanism so yes it can be used for what you
suggest. I know Stephane has submitted a plugin for notifications but
I haven't looked at it yes so I don't know if it uses this mechanism
or not. If not, then yes we should probably make it use it as the
other solution (scheduling) is not as good. That said, there are the
2 needs:
* you may want to receive notifications as soon as a page is modified
* or you may want to received notifications, say once a day with all
modifications grouped in a single email
All that said, the primary use case for notifications that I see if
for performance improvements and more specifically for refreshing
caches.
Thanks
-Vincent
> On 7/21/07, Vincent Massol <vincent at massol.net> wrote:
> For those interested I've sent a patch for implementing a new
> notification mechanism.
> It's available here:
>
> http://jira.xwiki.org/jira/browse/XWIKI-1522
>
> I'd love to get feedback on this. Here's what I say in there:
>
> "
> At the place where you want to register for an event:
>
> getObservationManager().addListener(new DocumentSaveEvent
> ("DocumentToWatch"), listener);
>
> At the place where you want to receive for an event:
>
> public class MyListener implements EventListener
> {
> public void onEvent(Event event, Object source, Object data)
> {
> ...
> }
> }
>
> At the place where you want to fire notifications to event listeners:
>
> getObservationManager().notify(new DocumentSaveEvent
> ("SomeDocument"), "some source", "some data");
>
> It's easily extensible and you can create all sorts of events as
> it's fully generic.
> "
>
> Have a look at the implementation. You'll see I have even
> introduced the notion of EventFilter so that we can have regex when
> registering interest for an event.
>
> Thanks
> -Vincent
>
>
>
> --
> You receive this message as a subscriber of the xwiki-
> dev at objectweb.org mailing list.
> To unsubscribe: mailto:xwiki-dev-unsubscribe at objectweb.org
> For general help: mailto: sympa at objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/
> wws
>
>
>
> --
> You receive this message as a subscriber of the xwiki-
> dev at objectweb.org mailing list.
> To unsubscribe: mailto:xwiki-dev-unsubscribe at objectweb.org
> For general help: mailto:sympa at objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/
> wws
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/devs/attachments/20070721/18d86e2a/attachment.html
More information about the devs
mailing list