Announcement Announcement Module
Collapse
No announcement yet.
Which is better: ELF vs. Spring Events ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Which is better: ELF vs. Spring Events ?

    I have seen a few people in this forum are using the ELF framework for event publishing. Is there any advantage to using the ELF framework over the current Spring RCP-style events such as ApplicationLifeCycleEvent which are published using getApplicationContext().publishEvent(...) ?

    -Trey

  • #2
    Trey,

    I use ELF for my internal application event passing. There's a couple of things I like about it. The biggest thing for me is that it allows you to specify your own event classes and associate listeners. So rather than processing generic ApplicationEvent you process your own specific event with any associated semantics you give it. It also allows you to map event types to specific methods within a listener, much like swing has multiple methods in a MouseListener for example. Finally, it has the concept of event channels which means events get propagated only to the listeners that are interested.
    All of these make the code much easier to read and maintain as opposed to the usual if(event instanceof x) constructs you end up seeing with generic event listeners.

    I'm sure you could do something along these lines with the spring event system either with a more advanced event dispatcher implementation (that might actually be a way to integrate ELF with Spring) or with some sort of application specific event handler implementation.

    Jonny

    Comment

    Working...
    X