Whenever an article (of any type) is posted to Traction, an event is generated. Listeners are plug-ins that can listen for these events and take any action.
Traction includes listeners for:
Email notification
Jabber instant message notification
Saving copies of Traction pages as static web pages.
Additional listeners can be written using Traction's Java SDK. For more information on creating custom listeners, see the Knowledge Base article Server5519 (requires login).
To enable listeners, you must check the Enable checkbox.
The list of listeners currently configured appears below.
Starting with version 3.7, listeners can be individually enabled and disabled using the checkboxes in the last column.
How can I create a listener that updates a file with Traction view contents each time the server is updated?
The following reprint of the Knowledge Base article Support1032 is provided for developers.
The Url2File listener lets you specify a set of Traction views and the files to which their content should be written. Each time an entry is added to one of the matching projects, all the pages are updated.
One use for this is to have a static RSS XML file updated each time an entry is added to Traction, so that every RSS view doesn't have to demand extra CPU from the server.
Like all listeners, as many instances as you like can be registered; each listener can update one or more files.
To create a notifier called myrssnotifier that updates an RSS feed, first, create a new file "myrssnotifier.properties" in config/events/listeners/.
Note: Line breaks are significant! In this annotated example, lines beginning with # are comments and all lines shown using this style must start with a keyword followed by an = sign at the beginning of a line.
Into this file, add the line:
tractionview=tsi.sdk.view.listener.Url2File
This line specifies the Url2File listener, which handles updating the files.
Next, fill in the information that will appear in Server Setup | General, where the notifier can be turned on and off.
display_name=My RSS Feed Updater
description=Writes out a static copy of the RSS views we care about
Now, decided who the notifier will run as. Since we're doing a public RSS feed, we'll only include entries visible to Visitor.
# The user which this listener should run as. If unspecified, the listener runs as the
# user who posted the entry which triggered the listener
user=Visitor
Now, determine which projects should trigger the notifier to create output. Pay special attention to the requirement for a | pipe character before and after each project in the list.
# If set, updateprojects allows updates to happen only for the specified projects.
# there must be a | before the first and after the last project; the server
# checks for "|current project|" in the String below.
updateprojects=|Public|Comment|
# If set, skipprojects prevents updates for the listed projects. Same syntax rules # apply as for updateprojects.
skipprojects=|Private|
Finally, you can give a list of Traction URL's and the files to which they should be written. Note that filenames are relative to the server directory. Also note that each of the url/file pairs has a number after it, starting with 0.
# A list of urls and the files to which they should be published. all file paths are
# relative to the server directory, and all URL paths are relative to the root.