Simple Event Handling

RichardRodgers 8-June-06

Approach

Logical Model

  1. the default processor - do not remove
    event.processor.default = org.dspace.event.BasicProcessor
    event.processor.default.consumers = \
    org.dspace.event.SearchConsumer:0407, \
    org.dspace.event.BrowseConsumer:0407, \
    org.dspace.event.HistoryConsumer:0407 }}}

This configuration means: use the class `BasicProcessor` with consumer `SearchConsumer` using the filter 0407, followed by `BrowseConsumer` etc – which is essentially what DSpace currently does without any event mechanism: when an Item is updated, the search and browse indices are updated, and the history system records the change.

public void consume(Context context, Event event);

Hence for many purposes, using the event mechanism is as simple as writing a class that implements this method. The prototype code includes consumers for search, browse,
history, and even one for the subscriber email notifications.

Where's JMS?

  1. the default processor - do not remove
    event.processor.default = org.dspace.event.BasicProcessor
    event.processor.default.consumers = \
    org.dspace.event.HistoryConsumer:0407, \
    org.dspace.event.JMSConsumer:ffff
  1. the JMS processor

    event.processor.jms = org.dspace.event.JMSProcessor
    event.processor.jms.consumers = \
    org.dspace.event.SearchConsumer:0407, \
    org.dspace.event.BrowseConsumer:0407 }}}

Here, only history system updates are performed immediately (i.e. synchronously), and the events are passed to the `JMSConsumer` which simply posts the events as messages
onto a persistent JMS message queue. The `JMSProcessor`, which includes a main method so it can be invoked via the 'dsrun' utility, will then read the queue, and pass the
events onto its consumers, in this case search and browse.

Prototype code to be posted shortly. Comments welcome