Content Studio can manage and control server side events. They are handled differently depending on if they are synchronous os asynchronous.
Synchronous server-side events
A synchronous event in Content Studio is raised whenever any of the supported actions
occurs on a category were such an event handler has been registered. The main advantage
with these events is that they can undo (roll back) changes made to the content.
For example: if an event handler triggers when any document in the Test1 category
is approved and the event handler is set up to synchronize data with an external
system in an atomic way, it important that the event handler can undo the preceding
approve procedure made in Content Studio. Since synchronous event handler has the
capability to roll back events in Content Studio this type of event handler has
the character of being OnBefore event handlers.
Event | Description |
---|---|
OnBeforeDocumentSave |
This event is new in Content Studio 5.2
Occurs when a document is about to be saved or created
and before the OnDocumentSave event.
In this event, you can access the content that is about to be saved.
For example, you can analyze the content
of an uploaded file that is about to be saved and cancel
any further save operations.
Since nothing has been saved to the database in this event there is
no database transaction involved thus no rollback is performed but
an event handler subscribing to this event can cancel the rest of
the save operation if necessary.
|
OnDocumentApprove | Occurs when a document is approved. |
OnDocumentCreate | Occurs when a document is created. |
OnDocumentDelete | Occurs when a document is thrown in the recycling bin |
OnDocumentDestroy | Occurs when a document is permanently deleted. |
OnDocumentSave | Occurs when a document content is saved but after that its meta data has been saved. |
Handling asynchronous events
Synchronous event are handled by event handlers that are implemented as code libraries
(.DLL files), installed in the same folder as the Content Studio binaries are located.
They must implement the interface
Writing an event handler is an advanced task that is thoroughly described in the
article Creating a synchronous event
handler located in the Content Studio 5 SDK. For detailed information about
the event handler, see the
Asynchronous server-side events
Asynchronous events are similar to the synchronous events in that respect that they get invoked whenever a certain event occurs in Content Studio on a category that has one or more asynchronous event handler registered. When the event triggers, one or more event handlers gets queued in the Content Studio Service Manager queue and get executed whenever the Service Manager has time for it.
The Content Studio Service Manager is a service that handles background jobs in Content Studio, such as re-indexing XML documents.
Asynchronous events, unlike synchronous events, get handled in the background and cannot be rolled back and does not indicate failures to the caller. A common use for these events is when there is a need to send email or SMS messages to a number of recipients whenever a document is approved and published.
Event | Description |
---|---|
OnDocumentApprove | Occurs when a document is approved. |
OnDocumentCheckIn | Occurs when a document is checked in. |
OnDocumentCheckOut | Occurs when a document is checked out. |
OnDocumentDelete | Occurs when a document is thrown in the recycling bin |
OnDocumentDestroy | Occurs when a document is permanently deleted. |
OnDocumentExpire | Occurs when a document has expired. Supported in CS 5.2 and later. |
OnDocumentPublish | Occurs when a document is published. Supported in CS 5.2 and later. |
OnDocumentUnPublish | Occurs when a document is no longer published. Supported in CS 5.2 and later. |
OnDocumentReject | Occurs when a document is rejected. |
OnDocumentRevision | Occurs when a document is sent for revision. |
OnDocumentSave | Occurs when a document is saved. |
OnXMLIndexChange |
Occurs when a change in a document demands an update of the underlying xml index.
This event is handled synchronously by Content Studio when a document gets updated or deleted and gets handled in the background when one or more new EPT-fields are marked or unmarked as indexed. No custom event handling can be made for this event. |
OnDocumentSubscription | Occurs when a document is sent out to subscribers. |
OnTestDocumentSubscription | Occurs when an administrator tests the subscription service by sending a test message. |
Asychronous events can be handled in several ways:
Method | Description |
---|---|
Asynchronous event handler object |
A custom event handler gets executed by the Service Manager. Such an event handler
can be written in any of the .NET compatible languages available. Similar to a synchronous
event handler asynchronous event handlers must implement a certain interface,
This kind of event handlers are very powerful and can be developed and fully debugged in Visual Studio and are recommended whenever possible.
Writing a custom asynchronous event handler is an advanced programming task that
has been documented and exemplified in the Content Studio API documentation. See
the documentation for the
|
Http POST | When using this method Content Studio Service Manager will execute a regular ASPX-document using the Http post method. This document can be written in Content Studio or located on any other accessible web site. |
Http Get | When using this method Content Studio Service Manager will execute a regular ASPX-document using the Http get method. This document can be written in Content Studio or located on any other accessible web site. |
Calling a web service | When using this method Content Studio Service Manager will execute a regular Web service using the Http get method. This service can be written in Content Studio or located on any other accessible web site. |
Calling a regular executable application | When using this method the Content Studio Service Manager |