Forums / Install & configuration / Asynchronous Publishing 4.5

Asynchronous Publishing 4.5

Author Message

Andreas Dobrick

Friday 13 May 2011 5:51:43 am

Hello Community.

I try out new 4.5 features - especially asynchronous publishing. I think this is an interessting feature which could help to sort some issues out.

Asynchronous publishing is enabled and works fine so far. Furthermore I want to trigger a bash script after publishing deamon published queue items. Post-Queue-Hooks are looking exactly what I am looking for.

Could someone explain me how I would get Post-Queue-Hooks working? Manual isn't helping me in reason it is to short.

Thanks in advance for all your help.

Andreas Dobrick

Bertrand Dunogier

Friday 13 May 2011 7:00:36 am

Have you checked the "postHandling hook" paragraph in the Asynchronous Publishing feature document ?

I know it might not be an obvious place, but these files are a gold mine. If you already had tried with it, well, I apologize, and i'll try to help you a bit further with it !

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Andreas Dobrick

Monday 16 May 2011 12:39:35 am

The document for asynchronous publishing withing the feature docs don't help me to understand how it should work.

Can we go for an example? It think this will help best to understand how it works.

My publishing settings within content.ini

[PublishingSettings]
AsynchronousPublishing=enabled
PublishingProcessSlots=10
AsynchronousPublishingPostHandlingHooks[]=MyPriorityHandler::cleanup

I create a class file inside of a class folder

<?php
class MyPriorityHandler
{
public function cleanup( )
{
die( "HERE WE GO ASNYCHRONOUS - POST QUEUE HOOK" );
return "HERE WE GO ASNYCHRONOUS - POST QUEUE HOOK";
}
}
?>

For my understanding the post queue hook cleanup function from MyPriorityHandler class should be called after publishing and should end up in an die().

The problem is that application is still alive and it seems that the post queue hook is never called.

Bertrand Dunogier

Monday 16 May 2011 5:02:43 am

Hi.

After some testing, I have realized that this part of the feature is a bit broken. I have commited this morning a fix for it, and the postQueue hooks should now work correctly. You can get the fix from the ezpublish github: https://github.com/ezsystems/ezpublish/commit/8bb5850.

I have also written a demo extension of this feature to help you get on track. You can check it out from my github: https://github.com/bdunogier/ezpostqueuehandlerdemo. I hope this helps.

Looking forward to your feedback.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Andreas Dobrick

Monday 16 May 2011 8:32:54 am

Hi.

I replaced the four bugfixed files with those from github. Also I had a look at your example. I still have problems.

If I run the asynchronous daemon then I get error for error in a loop:

php bin/php/ezasynchonouspublisher.php

Process #10421 of object version #907 exited with status 255

Processing item #907

Process #10422 of object version #911 exited with status 255

Processing item #911

Process #10430 of object version #909 exited with status 255

Processing item #909

Process #10431 of object version #907 exited with status 255

Processing item #907

Process #10432 of object version #911 exited with status 255

[...]

Asynchonous Publishing still works fine. I can see the publishing result at the webpage - everything looks fine. I just get one more processing item at ezasynchonouspublisher loop which never ends.

If I stop publishing daemon and try to publish something then publishing status is still pending. Then I start the daemon again and the publishing finishes successful.

Bertrand Dunogier

Tuesday 17 May 2011 1:44:44 am

In which circumstances do you get these errors exactly ? Do you see the loop, over items 907 / 911 even without the hook ?

All the patch does is actually allow the hooks to be executed. The message "Process #XXXXX of object ..." comes from the method that collects exiting child processed (the ones that take care of the actual publishing). A 255 status usually means that a fatal error has occurred in the process. When this happens, the object is re-queued for later processing.

If you only get this error with a hook enabled, it would mean that your hook creates a fatal error. If your hook class is part of an extension, have you .regenerated the extensions autoloads ? Maybe you could just try my extension, it works as is on my eZ Publish, just by enabling it.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier