1 Reply Latest reply on Sep 23, 2009 7:33 AM by timfox

    Suggested examples to base an event system on

      I am currently evaluating HornetQ for an event system to integrate with my projects cache classes. The classes are POJOs which can optionally use an events framework that is hidden behind several interfaces. In a previous project the events framework was implemented using a CORBA Event Service, as part of the project was written in C++. My current project is a purely Java one, so JMS is a much more obvious and straighforward implementation choice.

      I'm working my way through the documentation, and was wondering if anyone could suggest which of the copious examples provided with the HornetQ download would make a good starting points for my implementation. The system consists of a number of loaders that import feeds once a day, and a Swing client that is used to make changes to data throughout the working day. I would like the loaders and Swing client to publish create, update, and delete notifications whenever records are modified in the database. In CORBA I would have setup a channel for each record type in an event broker. The Java code itself wouldn't need to create these channels or topics, as they would change very rarely. The cache classes would register as listeners to the relevant topics or channels, and flush cached objects on receipt of an update or delete notification.

      The API of the events system interfaces are as follows:

      public enum EventType {
       CREATE,
       UPDATE,
       DELETE
      }
      
      public interface Events {
      
       void publishMessage(String topic, Object id, EventType type);
      
       void addTopicListener(String topic, TopicListener listener);
      
       void removeTopicListener(String topic, TopicListener listener);
      }
      
      public interface TopicListener {
       receiveMessage(Object id, EventType type);
      }


      Any suggestions gratefully received, and if my cache classes are of interest to anyone I'd be happy post them on the web as they were written on my own time rather than any of my employers.