Skip to content

Listen for and respond to Fedora Repository updates based on an object's content model.

Notifications You must be signed in to change notification settings

alxp/fedora_microservices

Repository files navigation

Fedora Stomp listener and content model listeners

Authors: Jonathan Green <[email protected]>, Alexander O'Neill <[email protected]>

Developed as part of the Islandora project (http://islandora.ca). Currently maintained by Discovery Garden (discoverygarden.ca).

Installation requirements:

Dependencies:

This script relies on Python 2.6 or greater. This script uses the lxml, fcrepo, stompy and yapsy python libraries. Except for fcrpeo these should be downloaded and installed automatically if you run setup.py script:

$ python setup.py install

Note that the lxml libraries have caused problems with automatic installation on some operating systems.
Please use discoverygarden's fork of fcrepo at https://github.com/discoverygarden/fcrepo for best results.

Ubuntu:
apt-get install python-lxml

CentOS:
yum install python26
easy_install-2.6 lxml

If Cent complains when installing you may also need these packages: gcc libxml2 libxml2-devel libxslt libxslt-devel python26-devel python26-distribute

OSX:
See http://stackoverflow.com/questions/1512530/cant-install-lxml-python-2-6-3-osx-10-6-snow-leopard for Mac OS X 10.6 Snow Leopard installation.

Fedora Setup:

To use this package with Fedora's built-in ActiveMQ broker you will need to download the Spring distribution from http://www.springsource.org/download . Then copy the *.RELEASE.jar files from the download package's lib directory into $FEDORA_HOME/tomcat/webapps/fedora/WEB-INF/lib to enable Stomp support in Fedora's embedded ActiveMQ broker.

Then edit your Fedora instance's configuration to add a Stomp broker. Edit $FEDORA_HOME/server/config/fedora.fcfg and edit the messaging section
<param name="java.naming.provider.url" value="vm:(broker:(tcp://localhost:61616,stomp://localhost:61613))"/>

Adding the Stomp URL will send messages to both the ActiveMQ port on 61616 and the Stomp port on 61613.

Restart Fedora and it should be ready to go.

Note that by default Fedora credentials are not passed, and users can post to ActiveMQ without any security. Make sure users can’t access whatever port STOMP is listening to. 

This package contains a script islandora_listener.py and it also contains an init script islandora_microservices. The init script is written for debian based systems but should work with minor modifications on other systems.

Run islandora_listener.py with the following command-line parameters:
Usage: islandora_listener.py [options]

Options:
  -h, --help            show this help message and exit
  -C CONFIGFILE, --config-file=CONFIGFILE
                        Path of the configuration file for this listener
                        process instance.
  -P PLUGINPATH, --plugin-path=PLUGINPATH
                        Path to a directory with plugin files.

Copy the file islandora_listener.cfg.default to islandora_listener.cfg, and edit it with your configuration options. The sample config file contains comments that should explain all the options.

$ python islandora_listener.py -C /path/to/islandora_listener.cfg

This will tell the script to connect to the Stomp port on the server specified in the configuration file and listen for messages on the topics /topic/fedora.apim.update and /topic/islandora.  The script parses the recieved messages, and based on the options in the plugin config files calls the required plugins.

The plugins specified in the islandora_microservices.cfg file will be the only ones that run in this instance of the listener. The plugins in turn will only listen to the content models and messages specified in their configuration files. This allows you to have one instance of the script on your ABBYY FineReader server that only does OCR tasks and another instance of the script running on a different server that can do tasks like generating thumbnails, compressed JP2 images, etc. or any other task that doesn't need to be run on a specific server.

Plugins

Extend the functionality of the content model listener by adding a new plugin. The sample_plugin plugin gives a simple template that can be extended. Its important that every plugin has a cfg file or the plugin manager won't recognise it. The sample_plugin file gives an example and there is more documentation about the base class that plugins must extent in the plugin_manger.py file.

About

Listen for and respond to Fedora Repository updates based on an object's content model.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published