Invalidating cached properties upon publication of changes

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Invalidating cached properties upon publication of changes

Tobias Jeger
Hi,

my project is using the properties plug-in, and we experienced caching problems. During the
analysis, I see that the event-listener used for invalidating cache entries operates at the JCR
level, and therefore fires many more events at the listener than I consider necessary.

As the cache invalidation should logically be tied to the fact that the document has changed,
which, for the live version of the document, means that it has been (un-)published, I wonder if there
is an event-listener mechanism available at the workflow level, which would fire a single event for the
fact that a document has been saved / (un-)published / deleted. Does such a mechanism exist?

I'm at CMS 7.7.

thanks

Tobi


--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Frank van Lankvelt
On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]> wrote:

> Hi,
>
> my project is using the properties plug-in, and we experienced caching
> problems. During the
> analysis, I see that the event-listener used for invalidating cache entries
> operates at the JCR
> level, and therefore fires many more events at the listener than I consider
> necessary.
>
> As the cache invalidation should logically be tied to the fact that the
> document has changed,
> which, for the live version of the document, means that it has been
> (un-)published, I wonder if there
> is an event-listener mechanism available at the workflow level, which would
> fire a single event for the
> fact that a document has been saved / (un-)published / deleted. Does such a
> mechanism exist?
>
it does exist in Hippo CMS 7.8.  You can register a listener to the
Hippo event bus.

You could try something like this:

  HippoServiceRegistry.registerService(new Object() {

    @Subscribe
    public void handleEvent(HippoEvent event) {
        if (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
            HippoWorkflowEvent workflowEvent = new HippoWorkflowEvent(event);
            if ("publish".equals(workflowEvent.methodName())) {
                  // further checks to filter events, e.g. for document path
                  ... invalidate cache ...
            }
        }
     }
  }, HippoEventBus.class);

cheers, Frank

> I'm at CMS 7.7.
>
> thanks
>
> Tobi
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Tobias Jeger
Sounds like what I'm looking for.

I get no hit looking for documentation of either HippoServiceRegistry or HippoEventBus on the .org/7_8 site.
Is that still to be published, or should I be looking elsewhere?

thanks

Tobi


On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt <[hidden email]> wrote:
On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]> wrote:
> Hi,
>
> my project is using the properties plug-in, and we experienced caching
> problems. During the
> analysis, I see that the event-listener used for invalidating cache entries
> operates at the JCR
> level, and therefore fires many more events at the listener than I consider
> necessary.
>
> As the cache invalidation should logically be tied to the fact that the
> document has changed,
> which, for the live version of the document, means that it has been
> (un-)published, I wonder if there
> is an event-listener mechanism available at the workflow level, which would
> fire a single event for the
> fact that a document has been saved / (un-)published / deleted. Does such a
> mechanism exist?
>
it does exist in Hippo CMS 7.8.  You can register a listener to the
Hippo event bus.

You could try something like this:

  HippoServiceRegistry.registerService(new Object() {

    @Subscribe
    public void handleEvent(HippoEvent event) {
        if (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
            HippoWorkflowEvent workflowEvent = new HippoWorkflowEvent(event);
            if ("publish".equals(workflowEvent.methodName())) {
                  // further checks to filter events, e.g. for document path
                  ... invalidate cache ...
            }
        }
     }
  }, HippoEventBus.class);

cheers, Frank

> I'm at CMS 7.7.
>
> thanks
>
> Tobi
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Ard
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Ard
In reply to this post by Frank van Lankvelt
On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
<[hidden email]> wrote:

> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]> wrote:
>> Hi,
>>
>> my project is using the properties plug-in, and we experienced caching
>> problems. During the
>> analysis, I see that the event-listener used for invalidating cache entries
>> operates at the JCR
>> level, and therefore fires many more events at the listener than I consider
>> necessary.
>>
>> As the cache invalidation should logically be tied to the fact that the
>> document has changed,
>> which, for the live version of the document, means that it has been
>> (un-)published, I wonder if there
>> is an event-listener mechanism available at the workflow level, which would
>> fire a single event for the
>> fact that a document has been saved / (un-)published / deleted. Does such a
>> mechanism exist?
>>
> it does exist in Hippo CMS 7.8.  You can register a listener to the
> Hippo event bus.
>
> You could try something like this:
>
>   HippoServiceRegistry.registerService(new Object() {
>
>     @Subscribe
>     public void handleEvent(HippoEvent event) {
>         if (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>             HippoWorkflowEvent workflowEvent = new HippoWorkflowEvent(event);
>             if ("publish".equals(workflowEvent.methodName())) {

Does this also already work for scheduled publish and unpublish? The
problem when I look at it before was that in that case the methodName
would only be something like 'request' IIRC

Regards Ard

>                   // further checks to filter events, e.g. for document path
>                   ... invalidate cache ...
>             }
>         }
>      }
>   }, HippoEventBus.class);
>
> cheers, Frank
>
>> I'm at CMS 7.7.
>>
>> thanks
>>
>> Tobi
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US +1 877 414 4776 (toll free)
>> Europe +31(0)20 522 4466
>> www.onehippo.com
>>
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Frank van Lankvelt-2
In reply to this post by Tobias Jeger

On 21 dec. 2012, at 13:20, Tobias Jeger <[hidden email]> wrote:

Sounds like what I'm looking for.

I get no hit looking for documentation of either HippoServiceRegistry or HippoEventBus on the .org/7_8 site.
Is that still to be published, or should I be looking elsewhere?

That should indeed be the place.  I'll create the page in the new year, my apologies for not having this done yet.  These events should make it easier to support a number of use-cases, and we'll likely publish more events to the event bus.  You can of course also post and subscribe to your own, custom, events.

Cheers, Frank

thanks

Tobi


On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt <[hidden email]> wrote:
On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]> wrote:
> Hi,
>
> my project is using the properties plug-in, and we experienced caching
> problems. During the
> analysis, I see that the event-listener used for invalidating cache entries
> operates at the JCR
> level, and therefore fires many more events at the listener than I consider
> necessary.
>
> As the cache invalidation should logically be tied to the fact that the
> document has changed,
> which, for the live version of the document, means that it has been
> (un-)published, I wonder if there
> is an event-listener mechanism available at the workflow level, which would
> fire a single event for the
> fact that a document has been saved / (un-)published / deleted. Does such a
> mechanism exist?
>
it does exist in Hippo CMS 7.8.  You can register a listener to the
Hippo event bus.

You could try something like this:

  HippoServiceRegistry.registerService(new Object() {

    @Subscribe
    public void handleEvent(HippoEvent event) {
        if (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
            HippoWorkflowEvent workflowEvent = new HippoWorkflowEvent(event);
            if ("publish".equals(workflowEvent.methodName())) {
                  // further checks to filter events, e.g. for document path
                  ... invalidate cache ...
            }
        }
     }
  }, HippoEventBus.class);

cheers, Frank

> I'm at CMS 7.7.
>
> thanks
>
> Tobi
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Frank van Lankvelt-2
In reply to this post by Ard

On 21 dec. 2012, at 13:32, Ard Schrijvers <[hidden email]> wrote:

> On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
> <[hidden email]> wrote:
>> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]> wrote:
>>> Hi,
>>>
>>> my project is using the properties plug-in, and we experienced caching
>>> problems. During the
>>> analysis, I see that the event-listener used for invalidating cache entries
>>> operates at the JCR
>>> level, and therefore fires many more events at the listener than I consider
>>> necessary.
>>>
>>> As the cache invalidation should logically be tied to the fact that the
>>> document has changed,
>>> which, for the live version of the document, means that it has been
>>> (un-)published, I wonder if there
>>> is an event-listener mechanism available at the workflow level, which would
>>> fire a single event for the
>>> fact that a document has been saved / (un-)published / deleted. Does such a
>>> mechanism exist?
>>>
>> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> Hippo event bus.
>>
>> You could try something like this:
>>
>>  HippoServiceRegistry.registerService(new Object() {
>>
>>    @Subscribe
>>    public void handleEvent(HippoEvent event) {
>>        if (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>>            HippoWorkflowEvent workflowEvent = new HippoWorkflowEvent(event);
>>            if ("publish".equals(workflowEvent.methodName())) {
>
> Does this also already work for scheduled publish and unpublish? The
> problem when I look at it before was that in that case the methodName
> would only be something like 'request' IIRC
>
It should post events for publish, please file an issue if this this does not work.

Cheers, Frank

> Regards Ard
>
>>                  // further checks to filter events, e.g. for document path
>>                  ... invalidate cache ...
>>            }
>>        }
>>     }
>>  }, HippoEventBus.class);
>>
>> cheers, Frank
>>
>>> I'm at CMS 7.7.
>>>
>>> thanks
>>>
>>> Tobi
>>>
>>>
>>> --
>>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>>> Boston - 1 Broadway, Cambridge, MA 02142
>>>
>>> US +1 877 414 4776 (toll free)
>>> Europe +31(0)20 522 4466
>>> www.onehippo.com
>>>
>>> _______________________________________________
>>> Hippo-cms7-user mailing list and forums
>>> http://www.onehippo.org/cms7/support/forums.html
>>
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US +1 877 414 4776 (toll free)
>> Europe +31(0)20 522 4466
>> www.onehippo.com
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

b.vanderschans@onehippo.com
In reply to this post by Frank van Lankvelt
On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
<[hidden email]> wrote:

> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]> wrote:
>> Hi,
>>
>> my project is using the properties plug-in, and we experienced caching
>> problems. During the
>> analysis, I see that the event-listener used for invalidating cache entries
>> operates at the JCR
>> level, and therefore fires many more events at the listener than I consider
>> necessary.
>>
>> As the cache invalidation should logically be tied to the fact that the
>> document has changed,
>> which, for the live version of the document, means that it has been
>> (un-)published, I wonder if there
>> is an event-listener mechanism available at the workflow level, which would
>> fire a single event for the
>> fact that a document has been saved / (un-)published / deleted. Does such a
>> mechanism exist?
>>
> it does exist in Hippo CMS 7.8.  You can register a listener to the
> Hippo event bus.

Afaik the events over the HippoEventBus are only guaranteed to work
locally on the cluster node. For clustering I think it depends on the
the logging of the events to the repository which is not enabled in
all deployments for performance reasons. So you might invalidate the
properties on one node in the cluster but still used the cached
version on another cluster node.

Regards,
Bart
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Tobias Jeger


Afaik the events over the HippoEventBus are only guaranteed to work
locally on the cluster node. For clustering I think it depends on the
the logging of the events to the repository which is not enabled in
all deployments for performance reasons. So you might invalidate the
properties on one node in the cluster but still used the cached
version on another cluster node.


...which would be a show-stopper in my case (and many others, I suspect...)

Tobi
 


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Unico Hommes
On Mon, Dec 24, 2012 at 12:04 PM, Tobias Jeger <[hidden email]> wrote:

>
>>
>> Afaik the events over the HippoEventBus are only guaranteed to work
>> locally on the cluster node. For clustering I think it depends on the
>> the logging of the events to the repository which is not enabled in
>> all deployments for performance reasons. So you might invalidate the
>> properties on one node in the cluster but still used the cached
>> version on another cluster node.
>>
>
> ...which would be a show-stopper in my case (and many others, I suspect...)
>

For forge plugins in general I think you shouldn't rely on the
workflow eventing to be available. It is ok to provide an
implementation that uses it but make sure you supply a default that
doesn't.

--
Unico
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Wouter Danes-2
you can just use observers, right? That allows you to monitor nodes for changes..

Unico Hommes <[hidden email]>schreef:


On Mon, Dec 24, 2012 at 12:04 PM, Tobias Jeger <[hidden email]> wrote:

>
>>
>> Afaik the events over the HippoEventBus are only guaranteed to work
>> locally on the cluster node. For clustering I think it depends on the
>> the logging of the events to the repository which is not enabled in
>> all deployments for performance reasons. So you might invalidate the
>> properties on one node in the cluster but still used the cached
>> version on another cluster node.
>>
>
> ...which would be a show-stopper in my case (and many others, I suspect...)
>

For forge plugins in general I think you shouldn't rely on the
workflow eventing to be available. It is ok to provide an
implementation that uses it but make sure you supply a default that
doesn't.

--
Unico
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Frank van Lankvelt-2
In reply to this post by b.vanderschans@onehippo.com

On 24 dec. 2012, at 11:02, Bart van der Schans <[hidden email]> wrote:

> On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
> <[hidden email]> wrote:
>> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]> wrote:
>>> Hi,
>>>
>>> my project is using the properties plug-in, and we experienced caching
>>> problems. During the
>>> analysis, I see that the event-listener used for invalidating cache entries
>>> operates at the JCR
>>> level, and therefore fires many more events at the listener than I consider
>>> necessary.
>>>
>>> As the cache invalidation should logically be tied to the fact that the
>>> document has changed,
>>> which, for the live version of the document, means that it has been
>>> (un-)published, I wonder if there
>>> is an event-listener mechanism available at the workflow level, which would
>>> fire a single event for the
>>> fact that a document has been saved / (un-)published / deleted. Does such a
>>> mechanism exist?
>>>
>> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> Hippo event bus.
>
> Afaik the events over the HippoEventBus are only guaranteed to work
> locally on the cluster node. For clustering I think it depends on the
> the logging of the events to the repository which is not enabled in
> all deployments for performance reasons. So you might invalidate the
> properties on one node in the cluster but still used the cached
> version on another cluster node.
>
That's true, for broadcasting the events indeed need to be persisted.

If the performance problems are too severe to make this a viable option, we should look into other event distribution mechanisms.  Those are not yet available, though.  Those would also have an impact on deployment, so we'll need to agree on a solution.

In the past, I've implemented a broadcasting solution based on jgroups where the repository was used for registration and discovery.  (so no shared filesystem necessary, for instance)  So that could probably be used on a short term.

Cheers, Frank

> Regards,
> Bart
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Ard
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Ard
In reply to this post by Wouter Danes-2
On Mon, Dec 24, 2012 at 8:23 PM, Wouter Danes <[hidden email]> wrote:
> you can just use observers, right? That allows you to monitor nodes for changes..

well, that is how it currently works as Tobias explains in his first
mail, and also what the shortcomings are. Typically these shortcomings
are a result of using SNS below a handle. If you could by the jcr
event path identify that it was about a live document, or for example
because live documents would be located in a different workspace,
then, he wouldn't have this problem in the first place.

So @Tobias : I think for the time being you are stuck with how it
currently works without really having a decent alternative. Reloading
properties docs  should however be very fast though, so not really a
problem, even when having many jcr events and thus many reloads. Also,
I've been bitten very frequently in the past already by this (think
about efficient hst cache invalidation) and there is no short term
solution. Whenever we can address this, we will, and then you will
know :)

Regards Ard

>
> Unico Hommes <[hidden email]>schreef:
>
>
> On Mon, Dec 24, 2012 at 12:04 PM, Tobias Jeger <[hidden email]> wrote:
>>
>>>
>>> Afaik the events over the HippoEventBus are only guaranteed to work
>>> locally on the cluster node. For clustering I think it depends on the
>>> the logging of the events to the repository which is not enabled in
>>> all deployments for performance reasons. So you might invalidate the
>>> properties on one node in the cluster but still used the cached
>>> version on another cluster node.
>>>
>>
>> ...which would be a show-stopper in my case (and many others, I suspect...)
>>
>
> For forge plugins in general I think you shouldn't rely on the
> workflow eventing to be available. It is ok to provide an
> implementation that uses it but make sure you supply a default that
> doesn't.
>
> --
> Unico
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Frank van Lankvelt
In reply to this post by Frank van Lankvelt-2
The page has been created, see
http://www.onehippo.org/7_8/library/concepts/hippo-services/event-bus.html
for details on the event bus.

cheers, Frank

On Mon, Dec 24, 2012 at 1:29 AM, Frank van Lankvelt
<[hidden email]> wrote:

>
> On 21 dec. 2012, at 13:20, Tobias Jeger <[hidden email]> wrote:
>
> Sounds like what I'm looking for.
>
> I get no hit looking for documentation of either HippoServiceRegistry or
> HippoEventBus on the .org/7_8 site.
> Is that still to be published, or should I be looking elsewhere?
>
> That should indeed be the place.  I'll create the page in the new year, my
> apologies for not having this done yet.  These events should make it easier
> to support a number of use-cases, and we'll likely publish more events to
> the event bus.  You can of course also post and subscribe to your own,
> custom, events.
>
> Cheers, Frank
>
> thanks
>
> Tobi
>
>
> On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
> <[hidden email]> wrote:
>>
>> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]>
>> wrote:
>> > Hi,
>> >
>> > my project is using the properties plug-in, and we experienced caching
>> > problems. During the
>> > analysis, I see that the event-listener used for invalidating cache
>> > entries
>> > operates at the JCR
>> > level, and therefore fires many more events at the listener than I
>> > consider
>> > necessary.
>> >
>> > As the cache invalidation should logically be tied to the fact that the
>> > document has changed,
>> > which, for the live version of the document, means that it has been
>> > (un-)published, I wonder if there
>> > is an event-listener mechanism available at the workflow level, which
>> > would
>> > fire a single event for the
>> > fact that a document has been saved / (un-)published / deleted. Does
>> > such a
>> > mechanism exist?
>> >
>> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> Hippo event bus.
>>
>> You could try something like this:
>>
>>   HippoServiceRegistry.registerService(new Object() {
>>
>>     @Subscribe
>>     public void handleEvent(HippoEvent event) {
>>         if
>> (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>>             HippoWorkflowEvent workflowEvent = new
>> HippoWorkflowEvent(event);
>>             if ("publish".equals(workflowEvent.methodName())) {
>>                   // further checks to filter events, e.g. for document
>> path
>>                   ... invalidate cache ...
>>             }
>>         }
>>      }
>>   }, HippoEventBus.class);
>>
>> cheers, Frank
>>
>> > I'm at CMS 7.7.
>> >
>> > thanks
>> >
>> > Tobi
>> >
>> >
>> > --
>> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> > Boston - 1 Broadway, Cambridge, MA 02142
>> >
>> > US +1 877 414 4776 (toll free)
>> > Europe +31(0)20 522 4466
>> > www.onehippo.com
>> >
>> > _______________________________________________
>> > Hippo-cms7-user mailing list and forums
>> > http://www.onehippo.org/cms7/support/forums.html
>>
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US +1 877 414 4776 (toll free)
>> Europe +31(0)20 522 4466
>> www.onehippo.com
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Tobias Jeger
Thanks.

I just read it through and have a few remarks/questions. Maybe they help in making the doc even better, or maybe I'm thinking nonsense...

1) The note about the "non-persisted" listener only receiving local events may deserve some more boldness. I'd expect the typical
case of trying to catch a workflow event in a production environment to suffer from this problem..?
2) If my assumption in 1) is the case, wouldn't it make sense to primarily advertise persisted listeners (as they would cover the common case), and then document the local variant as a more specialized alternative?
3) In the persisted code example, you wouldn't need to import the HippoEvent, right?
4) Would registration of the persisted listener be identical (except for MyListener => MyPersistedListener)?
5) What is the broadcast module? Is it common knowledge? (add link to existing documentation?) I'd appreciate some more text to get the bigger picture.
6) This may be over the top, but: as other cluster nodes can change while the local node is offline. Would workflow-related events happening on a remote cluster node while the local node is offline in any way be buffered for the local node to process once it's back online, or would these events simply be missed?

cheers

Tobi


On Mon, Dec 31, 2012 at 1:25 PM, Frank van Lankvelt <[hidden email]> wrote:
The page has been created, see
http://www.onehippo.org/7_8/library/concepts/hippo-services/event-bus.html
for details on the event bus.

cheers, Frank

On Mon, Dec 24, 2012 at 1:29 AM, Frank van Lankvelt
<[hidden email]> wrote:
>
> On 21 dec. 2012, at 13:20, Tobias Jeger <[hidden email]> wrote:
>
> Sounds like what I'm looking for.
>
> I get no hit looking for documentation of either HippoServiceRegistry or
> HippoEventBus on the .org/7_8 site.
> Is that still to be published, or should I be looking elsewhere?
>
> That should indeed be the place.  I'll create the page in the new year, my
> apologies for not having this done yet.  These events should make it easier
> to support a number of use-cases, and we'll likely publish more events to
> the event bus.  You can of course also post and subscribe to your own,
> custom, events.
>
> Cheers, Frank
>
> thanks
>
> Tobi
>
>
> On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
> <[hidden email]> wrote:
>>
>> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]>
>> wrote:
>> > Hi,
>> >
>> > my project is using the properties plug-in, and we experienced caching
>> > problems. During the
>> > analysis, I see that the event-listener used for invalidating cache
>> > entries
>> > operates at the JCR
>> > level, and therefore fires many more events at the listener than I
>> > consider
>> > necessary.
>> >
>> > As the cache invalidation should logically be tied to the fact that the
>> > document has changed,
>> > which, for the live version of the document, means that it has been
>> > (un-)published, I wonder if there
>> > is an event-listener mechanism available at the workflow level, which
>> > would
>> > fire a single event for the
>> > fact that a document has been saved / (un-)published / deleted. Does
>> > such a
>> > mechanism exist?
>> >
>> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> Hippo event bus.
>>
>> You could try something like this:
>>
>>   HippoServiceRegistry.registerService(new Object() {
>>
>>     @Subscribe
>>     public void handleEvent(HippoEvent event) {
>>         if
>> (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>>             HippoWorkflowEvent workflowEvent = new
>> HippoWorkflowEvent(event);
>>             if ("publish".equals(workflowEvent.methodName())) {
>>                   // further checks to filter events, e.g. for document
>> path
>>                   ... invalidate cache ...
>>             }
>>         }
>>      }
>>   }, HippoEventBus.class);
>>
>> cheers, Frank
>>
>> > I'm at CMS 7.7.
>> >
>> > thanks
>> >
>> > Tobi
>> >
>> >
>> > --
>> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> > Boston - 1 Broadway, Cambridge, MA 02142
>> >
>> > US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> > Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> > www.onehippo.com
>> >
>> > _______________________________________________
>> > Hippo-cms7-user mailing list and forums
>> > http://www.onehippo.org/cms7/support/forums.html
>>
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> www.onehippo.com
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Frank van Lankvelt
thanks for your comments!

Responses are inline:

On Mon, Dec 31, 2012 at 3:19 PM, Tobias Jeger <[hidden email]> wrote:
> Thanks.
>
> I just read it through and have a few remarks/questions. Maybe they help in
> making the doc even better, or maybe I'm thinking nonsense...
>
> 1) The note about the "non-persisted" listener only receiving local events
> may deserve some more boldness. I'd expect the typical
> case of trying to catch a workflow event in a production environment to
> suffer from this problem..?

I'm not so sure about this.  Remember that one would typically
register a listener on each cluster node.
So in use cases where e.g. an external system needs to be notified,
mails should be sent, solr index needs to be updated, etcetera, no
such broadcasting is necessary.  The node that executed the workflow
operation will also have it's listener do the remote call.

Only when the event must be processed on each cluster node, the
broadcast is required.  This is the case for a replicated cache, but
that's not the only game in town.

> 2) If my assumption in 1) is the case, wouldn't it make sense to primarily
> advertise persisted listeners (as they would cover the common case), and
> then document the local variant as a more specialized alternative?

Since broadcasting events is more expensive than just dispatching them
locally, I would rather promote the (replicated) local listeners.
Only when they turn out not to be able to satisfy the requirements,
one should turn to the persisted events.

> 3) In the persisted code example, you wouldn't need to import the
> HippoEvent, right?

good catch. thanks.

> 4) Would registration of the persisted listener be identical (except for
> MyListener => MyPersistedListener)?

yep

> 5) What is the broadcast module? Is it common knowledge? (add link to
> existing documentation?) I'd appreciate some more text to get the bigger
> picture.

it's actually an implementation detail.  The module specifically deals
with picking up and dispatching persisted events.

> 6) This may be over the top, but: as other cluster nodes can change while
> the local node is offline. Would workflow-related events happening on a
> remote cluster node while the local node is offline in any way be buffered
> for the local node to process once it's back online, or would these events
> simply be missed?
>
they would indeed be processed once it comes back online.  If that
didn't take too long; the queryLimit and maxEventAge parameters
control how old the oldest request can be.  This is to protect the
system from getting into a situation where dispatching these events
takes too much resources.

In regular re-deploy scenarios the limits should not be reached and so
all events are indeed dispatched.

cheers, Frank

> cheers
>
> Tobi
>
>
>
> On Mon, Dec 31, 2012 at 1:25 PM, Frank van Lankvelt
> <[hidden email]> wrote:
>>
>> The page has been created, see
>> http://www.onehippo.org/7_8/library/concepts/hippo-services/event-bus.html
>> for details on the event bus.
>>
>> cheers, Frank
>>
>> On Mon, Dec 24, 2012 at 1:29 AM, Frank van Lankvelt
>> <[hidden email]> wrote:
>> >
>> > On 21 dec. 2012, at 13:20, Tobias Jeger <[hidden email]> wrote:
>> >
>> > Sounds like what I'm looking for.
>> >
>> > I get no hit looking for documentation of either HippoServiceRegistry or
>> > HippoEventBus on the .org/7_8 site.
>> > Is that still to be published, or should I be looking elsewhere?
>> >
>> > That should indeed be the place.  I'll create the page in the new year,
>> > my
>> > apologies for not having this done yet.  These events should make it
>> > easier
>> > to support a number of use-cases, and we'll likely publish more events
>> > to
>> > the event bus.  You can of course also post and subscribe to your own,
>> > custom, events.
>> >
>> > Cheers, Frank
>> >
>> > thanks
>> >
>> > Tobi
>> >
>> >
>> > On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
>> > <[hidden email]> wrote:
>> >>
>> >> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > my project is using the properties plug-in, and we experienced
>> >> > caching
>> >> > problems. During the
>> >> > analysis, I see that the event-listener used for invalidating cache
>> >> > entries
>> >> > operates at the JCR
>> >> > level, and therefore fires many more events at the listener than I
>> >> > consider
>> >> > necessary.
>> >> >
>> >> > As the cache invalidation should logically be tied to the fact that
>> >> > the
>> >> > document has changed,
>> >> > which, for the live version of the document, means that it has been
>> >> > (un-)published, I wonder if there
>> >> > is an event-listener mechanism available at the workflow level, which
>> >> > would
>> >> > fire a single event for the
>> >> > fact that a document has been saved / (un-)published / deleted. Does
>> >> > such a
>> >> > mechanism exist?
>> >> >
>> >> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> >> Hippo event bus.
>> >>
>> >> You could try something like this:
>> >>
>> >>   HippoServiceRegistry.registerService(new Object() {
>> >>
>> >>     @Subscribe
>> >>     public void handleEvent(HippoEvent event) {
>> >>         if
>> >> (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>> >>             HippoWorkflowEvent workflowEvent = new
>> >> HippoWorkflowEvent(event);
>> >>             if ("publish".equals(workflowEvent.methodName())) {
>> >>                   // further checks to filter events, e.g. for document
>> >> path
>> >>                   ... invalidate cache ...
>> >>             }
>> >>         }
>> >>      }
>> >>   }, HippoEventBus.class);
>> >>
>> >> cheers, Frank
>> >>
>> >> > I'm at CMS 7.7.
>> >> >
>> >> > thanks
>> >> >
>> >> > Tobi
>> >> >
>> >> >
>> >> > --
>> >> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> > Boston - 1 Broadway, Cambridge, MA 02142
>> >> >
>> >> > US +1 877 414 4776 (toll free)
>> >> > Europe +31(0)20 522 4466
>> >> > www.onehippo.com
>> >> >
>> >> > _______________________________________________
>> >> > Hippo-cms7-user mailing list and forums
>> >> > http://www.onehippo.org/cms7/support/forums.html
>> >>
>> >>
>> >>
>> >> --
>> >> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> Boston - 1 Broadway, Cambridge, MA 02142
>> >>
>> >> US +1 877 414 4776 (toll free)
>> >> Europe +31(0)20 522 4466
>> >> www.onehippo.com
>> >> _______________________________________________
>> >> Hippo-cms7-user mailing list and forums
>> >> http://www.onehippo.org/cms7/support/forums.html
>> >
>> >
>> >
>> >
>> > --
>> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> > Boston - 1 Broadway, Cambridge, MA 02142
>> >
>> > US +1 877 414 4776 (toll free)
>> > Europe +31(0)20 522 4466
>> > www.onehippo.com
>> >
>> > _______________________________________________
>> > Hippo-cms7-user mailing list and forums
>> > http://www.onehippo.org/cms7/support/forums.html
>>
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US +1 877 414 4776 (toll free)
>> Europe +31(0)20 522 4466
>> www.onehippo.com
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Tobias Jeger

> 1) The note about the "non-persisted" listener only receiving local events
> may deserve some more boldness. I'd expect the typical
> case of trying to catch a workflow event in a production environment to
> suffer from this problem..?

Only when the event must be processed on each cluster node, the
broadcast is required.  This is the case for a replicated cache, but
that's not the only game in town.

[Tobi] got it.
 
> 5) What is the broadcast module? Is it common knowledge? (add link to
> existing documentation?) I'd appreciate some more text to get the bigger
> picture.

it's actually an implementation detail.  The module specifically deals
with picking up and dispatching persisted events.

[Tobi] So, the event is not sent to the listener, but stored in the repository, and then there's
a second step where the event is - on a per-node-basis - read, processed and in some way marked as processed,
and a third step that takes care of (some sort of coordinated) cleanup, Do I understand that correctly?

What would be the role of the broadcast module in this? I guess step 3, but I can't relate it to broadcasting in any way (yet).
If this is a detail I shouldn't worry about, who is the intended reader of that paragraph in the documentation then? :-)

thanks

Tobi



>
>
>
> On Mon, Dec 31, 2012 at 1:25 PM, Frank van Lankvelt
> <[hidden email]> wrote:
>>
>> The page has been created, see
>> http://www.onehippo.org/7_8/library/concepts/hippo-services/event-bus.html
>> for details on the event bus.
>>
>> cheers, Frank
>>
>> On Mon, Dec 24, 2012 at 1:29 AM, Frank van Lankvelt
>> <[hidden email]> wrote:
>> >
>> > On 21 dec. 2012, at 13:20, Tobias Jeger <[hidden email]> wrote:
>> >
>> > Sounds like what I'm looking for.
>> >
>> > I get no hit looking for documentation of either HippoServiceRegistry or
>> > HippoEventBus on the .org/7_8 site.
>> > Is that still to be published, or should I be looking elsewhere?
>> >
>> > That should indeed be the place.  I'll create the page in the new year,
>> > my
>> > apologies for not having this done yet.  These events should make it
>> > easier
>> > to support a number of use-cases, and we'll likely publish more events
>> > to
>> > the event bus.  You can of course also post and subscribe to your own,
>> > custom, events.
>> >
>> > Cheers, Frank
>> >
>> > thanks
>> >
>> > Tobi
>> >
>> >
>> > On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
>> > <[hidden email]> wrote:
>> >>
>> >> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <[hidden email]>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > my project is using the properties plug-in, and we experienced
>> >> > caching
>> >> > problems. During the
>> >> > analysis, I see that the event-listener used for invalidating cache
>> >> > entries
>> >> > operates at the JCR
>> >> > level, and therefore fires many more events at the listener than I
>> >> > consider
>> >> > necessary.
>> >> >
>> >> > As the cache invalidation should logically be tied to the fact that
>> >> > the
>> >> > document has changed,
>> >> > which, for the live version of the document, means that it has been
>> >> > (un-)published, I wonder if there
>> >> > is an event-listener mechanism available at the workflow level, which
>> >> > would
>> >> > fire a single event for the
>> >> > fact that a document has been saved / (un-)published / deleted. Does
>> >> > such a
>> >> > mechanism exist?
>> >> >
>> >> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> >> Hippo event bus.
>> >>
>> >> You could try something like this:
>> >>
>> >>   HippoServiceRegistry.registerService(new Object() {
>> >>
>> >>     @Subscribe
>> >>     public void handleEvent(HippoEvent event) {
>> >>         if
>> >> (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>> >>             HippoWorkflowEvent workflowEvent = new
>> >> HippoWorkflowEvent(event);
>> >>             if ("publish".equals(workflowEvent.methodName())) {
>> >>                   // further checks to filter events, e.g. for document
>> >> path
>> >>                   ... invalidate cache ...
>> >>             }
>> >>         }
>> >>      }
>> >>   }, HippoEventBus.class);
>> >>
>> >> cheers, Frank
>> >>
>> >> > I'm at CMS 7.7.
>> >> >
>> >> > thanks
>> >> >
>> >> > Tobi
>> >> >
>> >> >
>> >> > --
>> >> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> > Boston - 1 Broadway, Cambridge, MA 02142
>> >> >
>> >> > US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> >> > Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> >> > www.onehippo.com
>> >> >
>> >> > _______________________________________________
>> >> > Hippo-cms7-user mailing list and forums
>> >> > http://www.onehippo.org/cms7/support/forums.html
>> >>
>> >>
>> >>
>> >> --
>> >> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> Boston - 1 Broadway, Cambridge, MA 02142
>> >>
>> >> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> >> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> >> www.onehippo.com
>> >> _______________________________________________
>> >> Hippo-cms7-user mailing list and forums
>> >> http://www.onehippo.org/cms7/support/forums.html
>> >
>> >
>> >
>> >
>> > --
>> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> > Boston - 1 Broadway, Cambridge, MA 02142
>> >
>> > US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> > Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> > www.onehippo.com
>> >
>> > _______________________________________________
>> > Hippo-cms7-user mailing list and forums
>> > http://www.onehippo.org/cms7/support/forums.html
>>
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> www.onehippo.com
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Frank van Lankvelt
On Mon, Dec 31, 2012 at 4:03 PM, Tobias Jeger <[hidden email]> wrote:

>
>> > 1) The note about the "non-persisted" listener only receiving local
>> > events
>> > may deserve some more boldness. I'd expect the typical
>> > case of trying to catch a workflow event in a production environment to
>> > suffer from this problem..?
>>
>> Only when the event must be processed on each cluster node, the
>> broadcast is required.  This is the case for a replicated cache, but
>> that's not the only game in town.
>
> [Tobi] got it.
>
>>
>> > 5) What is the broadcast module? Is it common knowledge? (add link to
>> > existing documentation?) I'd appreciate some more text to get the bigger
>> > picture.
>>
>> it's actually an implementation detail.  The module specifically deals
>> with picking up and dispatching persisted events.
>
> [Tobi] So, the event is not sent to the listener, but stored in the
> repository, and then there's
> a second step where the event is - on a per-node-basis - read, processed and
> in some way marked as processed,
> and a third step that takes care of (some sort of coordinated) cleanup, Do I
> understand that correctly?
>
that's correct.  The event logging was already there for a long time,
but it was only used in the recent activity plugin on the dashboard.
It is now implemented using a regular listener on the event bus.
The cleanup is covered in
http://www.onehippo.org/7_8/library/administration/maintenance/event-log-cleanup.html

> What would be the role of the broadcast module in this? I guess step 3, but
> I can't relate it to broadcasting in any way (yet).

The second step, publishing the event to the relevant listeners and
updating the listener timestamps, is the broadcast module's business.

> If this is a detail I shouldn't worry about, who is the intended reader of
> that paragraph in the documentation then? :-)
>
I've updated the section.  The jcr path still refers to the broadcast
module, but the description is now in terms of persisted events.

cheers, Frank

> thanks
>
> Tobi
>
>
>
>> >
>> >
>> >
>> > On Mon, Dec 31, 2012 at 1:25 PM, Frank van Lankvelt
>> > <[hidden email]> wrote:
>> >>
>> >> The page has been created, see
>> >>
>> >> http://www.onehippo.org/7_8/library/concepts/hippo-services/event-bus.html
>> >> for details on the event bus.
>> >>
>> >> cheers, Frank
>> >>
>> >> On Mon, Dec 24, 2012 at 1:29 AM, Frank van Lankvelt
>> >> <[hidden email]> wrote:
>> >> >
>> >> > On 21 dec. 2012, at 13:20, Tobias Jeger <[hidden email]> wrote:
>> >> >
>> >> > Sounds like what I'm looking for.
>> >> >
>> >> > I get no hit looking for documentation of either HippoServiceRegistry
>> >> > or
>> >> > HippoEventBus on the .org/7_8 site.
>> >> > Is that still to be published, or should I be looking elsewhere?
>> >> >
>> >> > That should indeed be the place.  I'll create the page in the new
>> >> > year,
>> >> > my
>> >> > apologies for not having this done yet.  These events should make it
>> >> > easier
>> >> > to support a number of use-cases, and we'll likely publish more
>> >> > events
>> >> > to
>> >> > the event bus.  You can of course also post and subscribe to your
>> >> > own,
>> >> > custom, events.
>> >> >
>> >> > Cheers, Frank
>> >> >
>> >> > thanks
>> >> >
>> >> > Tobi
>> >> >
>> >> >
>> >> > On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
>> >> > <[hidden email]> wrote:
>> >> >>
>> >> >> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger
>> >> >> <[hidden email]>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > my project is using the properties plug-in, and we experienced
>> >> >> > caching
>> >> >> > problems. During the
>> >> >> > analysis, I see that the event-listener used for invalidating
>> >> >> > cache
>> >> >> > entries
>> >> >> > operates at the JCR
>> >> >> > level, and therefore fires many more events at the listener than I
>> >> >> > consider
>> >> >> > necessary.
>> >> >> >
>> >> >> > As the cache invalidation should logically be tied to the fact
>> >> >> > that
>> >> >> > the
>> >> >> > document has changed,
>> >> >> > which, for the live version of the document, means that it has
>> >> >> > been
>> >> >> > (un-)published, I wonder if there
>> >> >> > is an event-listener mechanism available at the workflow level,
>> >> >> > which
>> >> >> > would
>> >> >> > fire a single event for the
>> >> >> > fact that a document has been saved / (un-)published / deleted.
>> >> >> > Does
>> >> >> > such a
>> >> >> > mechanism exist?
>> >> >> >
>> >> >> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> >> >> Hippo event bus.
>> >> >>
>> >> >> You could try something like this:
>> >> >>
>> >> >>   HippoServiceRegistry.registerService(new Object() {
>> >> >>
>> >> >>     @Subscribe
>> >> >>     public void handleEvent(HippoEvent event) {
>> >> >>         if
>> >> >> (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>> >> >>             HippoWorkflowEvent workflowEvent = new
>> >> >> HippoWorkflowEvent(event);
>> >> >>             if ("publish".equals(workflowEvent.methodName())) {
>> >> >>                   // further checks to filter events, e.g. for
>> >> >> document
>> >> >> path
>> >> >>                   ... invalidate cache ...
>> >> >>             }
>> >> >>         }
>> >> >>      }
>> >> >>   }, HippoEventBus.class);
>> >> >>
>> >> >> cheers, Frank
>> >> >>
>> >> >> > I'm at CMS 7.7.
>> >> >> >
>> >> >> > thanks
>> >> >> >
>> >> >> > Tobi
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> >> > Boston - 1 Broadway, Cambridge, MA 02142
>> >> >> >
>> >> >> > US +1 877 414 4776 (toll free)
>> >> >> > Europe +31(0)20 522 4466
>> >> >> > www.onehippo.com
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Hippo-cms7-user mailing list and forums
>> >> >> > http://www.onehippo.org/cms7/support/forums.html
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> >> Boston - 1 Broadway, Cambridge, MA 02142
>> >> >>
>> >> >> US +1 877 414 4776 (toll free)
>> >> >> Europe +31(0)20 522 4466
>> >> >> www.onehippo.com
>> >> >> _______________________________________________
>> >> >> Hippo-cms7-user mailing list and forums
>> >> >> http://www.onehippo.org/cms7/support/forums.html
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> > Boston - 1 Broadway, Cambridge, MA 02142
>> >> >
>> >> > US +1 877 414 4776 (toll free)
>> >> > Europe +31(0)20 522 4466
>> >> > www.onehippo.com
>> >> >
>> >> > _______________________________________________
>> >> > Hippo-cms7-user mailing list and forums
>> >> > http://www.onehippo.org/cms7/support/forums.html
>> >>
>> >>
>> >>
>> >> --
>> >> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> Boston - 1 Broadway, Cambridge, MA 02142
>> >>
>> >> US +1 877 414 4776 (toll free)
>> >> Europe +31(0)20 522 4466
>> >> www.onehippo.com
>> >> _______________________________________________
>> >> Hippo-cms7-user mailing list and forums
>> >> http://www.onehippo.org/cms7/support/forums.html
>> >
>> >
>> >
>> >
>> > --
>> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> > Boston - 1 Broadway, Cambridge, MA 02142
>> >
>> > US +1 877 414 4776 (toll free)
>> > Europe +31(0)20 522 4466
>> > www.onehippo.com
>> >
>> > _______________________________________________
>> > Hippo-cms7-user mailing list and forums
>> > http://www.onehippo.org/cms7/support/forums.html
>>
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US +1 877 414 4776 (toll free)
>> Europe +31(0)20 522 4466
>> www.onehippo.com
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Invalidating cached properties upon publication of changes

Tobias Jeger
ok, that makes things comprehensible for me, thanks a lot.

Tobi


On Tue, Jan 1, 2013 at 12:19 PM, Frank van Lankvelt <[hidden email]> wrote:
On Mon, Dec 31, 2012 at 4:03 PM, Tobias Jeger <[hidden email]> wrote:
>
>> > 1) The note about the "non-persisted" listener only receiving local
>> > events
>> > may deserve some more boldness. I'd expect the typical
>> > case of trying to catch a workflow event in a production environment to
>> > suffer from this problem..?
>>
>> Only when the event must be processed on each cluster node, the
>> broadcast is required.  This is the case for a replicated cache, but
>> that's not the only game in town.
>
> [Tobi] got it.
>
>>
>> > 5) What is the broadcast module? Is it common knowledge? (add link to
>> > existing documentation?) I'd appreciate some more text to get the bigger
>> > picture.
>>
>> it's actually an implementation detail.  The module specifically deals
>> with picking up and dispatching persisted events.
>
> [Tobi] So, the event is not sent to the listener, but stored in the
> repository, and then there's
> a second step where the event is - on a per-node-basis - read, processed and
> in some way marked as processed,
> and a third step that takes care of (some sort of coordinated) cleanup, Do I
> understand that correctly?
>
that's correct.  The event logging was already there for a long time,
but it was only used in the recent activity plugin on the dashboard.
It is now implemented using a regular listener on the event bus.
The cleanup is covered in
http://www.onehippo.org/7_8/library/administration/maintenance/event-log-cleanup.html

> What would be the role of the broadcast module in this? I guess step 3, but
> I can't relate it to broadcasting in any way (yet).

The second step, publishing the event to the relevant listeners and
updating the listener timestamps, is the broadcast module's business.

> If this is a detail I shouldn't worry about, who is the intended reader of
> that paragraph in the documentation then? :-)
>
I've updated the section.  The jcr path still refers to the broadcast
module, but the description is now in terms of persisted events.

cheers, Frank

> thanks
>
> Tobi
>
>
>
>> >
>> >
>> >
>> > On Mon, Dec 31, 2012 at 1:25 PM, Frank van Lankvelt
>> > <[hidden email]> wrote:
>> >>
>> >> The page has been created, see
>> >>
>> >> http://www.onehippo.org/7_8/library/concepts/hippo-services/event-bus.html
>> >> for details on the event bus.
>> >>
>> >> cheers, Frank
>> >>
>> >> On Mon, Dec 24, 2012 at 1:29 AM, Frank van Lankvelt
>> >> <[hidden email]> wrote:
>> >> >
>> >> > On 21 dec. 2012, at 13:20, Tobias Jeger <[hidden email]> wrote:
>> >> >
>> >> > Sounds like what I'm looking for.
>> >> >
>> >> > I get no hit looking for documentation of either HippoServiceRegistry
>> >> > or
>> >> > HippoEventBus on the .org/7_8 site.
>> >> > Is that still to be published, or should I be looking elsewhere?
>> >> >
>> >> > That should indeed be the place.  I'll create the page in the new
>> >> > year,
>> >> > my
>> >> > apologies for not having this done yet.  These events should make it
>> >> > easier
>> >> > to support a number of use-cases, and we'll likely publish more
>> >> > events
>> >> > to
>> >> > the event bus.  You can of course also post and subscribe to your
>> >> > own,
>> >> > custom, events.
>> >> >
>> >> > Cheers, Frank
>> >> >
>> >> > thanks
>> >> >
>> >> > Tobi
>> >> >
>> >> >
>> >> > On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
>> >> > <[hidden email]> wrote:
>> >> >>
>> >> >> On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger
>> >> >> <[hidden email]>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > my project is using the properties plug-in, and we experienced
>> >> >> > caching
>> >> >> > problems. During the
>> >> >> > analysis, I see that the event-listener used for invalidating
>> >> >> > cache
>> >> >> > entries
>> >> >> > operates at the JCR
>> >> >> > level, and therefore fires many more events at the listener than I
>> >> >> > consider
>> >> >> > necessary.
>> >> >> >
>> >> >> > As the cache invalidation should logically be tied to the fact
>> >> >> > that
>> >> >> > the
>> >> >> > document has changed,
>> >> >> > which, for the live version of the document, means that it has
>> >> >> > been
>> >> >> > (un-)published, I wonder if there
>> >> >> > is an event-listener mechanism available at the workflow level,
>> >> >> > which
>> >> >> > would
>> >> >> > fire a single event for the
>> >> >> > fact that a document has been saved / (un-)published / deleted.
>> >> >> > Does
>> >> >> > such a
>> >> >> > mechanism exist?
>> >> >> >
>> >> >> it does exist in Hippo CMS 7.8.  You can register a listener to the
>> >> >> Hippo event bus.
>> >> >>
>> >> >> You could try something like this:
>> >> >>
>> >> >>   HippoServiceRegistry.registerService(new Object() {
>> >> >>
>> >> >>     @Subscribe
>> >> >>     public void handleEvent(HippoEvent event) {
>> >> >>         if
>> >> >> (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
>> >> >>             HippoWorkflowEvent workflowEvent = new
>> >> >> HippoWorkflowEvent(event);
>> >> >>             if ("publish".equals(workflowEvent.methodName())) {
>> >> >>                   // further checks to filter events, e.g. for
>> >> >> document
>> >> >> path
>> >> >>                   ... invalidate cache ...
>> >> >>             }
>> >> >>         }
>> >> >>      }
>> >> >>   }, HippoEventBus.class);
>> >> >>
>> >> >> cheers, Frank
>> >> >>
>> >> >> > I'm at CMS 7.7.
>> >> >> >
>> >> >> > thanks
>> >> >> >
>> >> >> > Tobi
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> >> > Boston - 1 Broadway, Cambridge, MA 02142
>> >> >> >
>> >> >> > US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> >> >> > Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> >> >> > www.onehippo.com
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Hippo-cms7-user mailing list and forums
>> >> >> > http://www.onehippo.org/cms7/support/forums.html
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> >> Boston - 1 Broadway, Cambridge, MA 02142
>> >> >>
>> >> >> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> >> >> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> >> >> www.onehippo.com
>> >> >> _______________________________________________
>> >> >> Hippo-cms7-user mailing list and forums
>> >> >> http://www.onehippo.org/cms7/support/forums.html
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> > Boston - 1 Broadway, Cambridge, MA 02142
>> >> >
>> >> > US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> >> > Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> >> > www.onehippo.com
>> >> >
>> >> > _______________________________________________
>> >> > Hippo-cms7-user mailing list and forums
>> >> > http://www.onehippo.org/cms7/support/forums.html
>> >>
>> >>
>> >>
>> >> --
>> >> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> >> Boston - 1 Broadway, Cambridge, MA 02142
>> >>
>> >> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> >> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> >> www.onehippo.com
>> >> _______________________________________________
>> >> Hippo-cms7-user mailing list and forums
>> >> http://www.onehippo.org/cms7/support/forums.html
>> >
>> >
>> >
>> >
>> > --
>> > Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> > Boston - 1 Broadway, Cambridge, MA 02142
>> >
>> > US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> > Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> > www.onehippo.com
>> >
>> > _______________________________________________
>> > Hippo-cms7-user mailing list and forums
>> > http://www.onehippo.org/cms7/support/forums.html
>>
>>
>>
>> --
>> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>> Boston - 1 Broadway, Cambridge, MA 02142
>>
>> US <a href="tel:%2B1%20877%20414%204776" value="+18774144776">+1 877 414 4776 (toll free)
>> Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466">+31(0)20 522 4466
>> www.onehippo.com
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html