When using Plone 4, I successfully created a subscriber event for additional processing while saving a custom content type. I did this using the interface Products.Archetypes.interfaces.IObjectInitializedEvent.
configure.zcml
<subscriber
for="mycustom.product.interfaces.IRepositoryItem
Products.Archetypes.interfaces.IObjectInitializedEvent"
handler=".subscribers.notifyCreatedRepositoryItem"
/>
subscribers.py
def notifyCreatedRepositoryItem(repositoryitem, event):
"""
This gets called on IObjectInitializedEvent - which occurs when a new object is created.
"""
my custom processing goes here. Should be asynchronous
However, additional processing can sometimes take too much time, and I was wondering if there is a way to run it in the background, that is, asynchronously.
Is it possible to trigger subscriber events asynchronously, for example, when you save an object?
source
share