Announcement Announcement Module
Collapse
No announcement yet.
Why should we use EventBus when using Cairngorm Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why should we use EventBus when using Cairngorm

    We are creating an application using the cairngorm framework. I have studied about the EventBus and came to know that it is used to establish decoupling between event publisher and event listener by using the pub/sub pattern i.e. by using this, we can assure that event publisher and event handler both are completely unknown of each other. But, if we think about the event dispatching machanism used in cairngorm framework by using "CairngormEventDispatcher.getInstace().dispatchEve nt(new eventABC())" , we found that in this case also the event publisher does not know about the event handler and vice a versa and the relation between these two is established through front controller.

    So, i want to know that is it useful to use EventBus instead of CairngormEventDispatcher or it is only burden. If it is useful, and we are using EventBus, then, why should we use front controller.
    Is there any sample code or any example where EventBus has been used with in Cairngorm framework.

  • #2
    Hey there,

    the main difference between the CairngormEventDispatcher and the EventBus is that the cairngorm dispatcher is meant specifically to map Events to Commands whereas the EventBus is more of a general event publishing/subscribing mechanism.
    For instance, Spring Actionscript offers a micro-MVC system that is very similar to Cairngorm but is completely metadata driven:
    http://www.springactionscript.org/do...s.html#d0e4996

    So, if you´re just interested in event/command mapping, by all means use Cairngorm, even though you need to watch out that you might run into trouble when you´re application consists of multiple modules that might listen for the same events, in which case you might run into trouble.

    The Spring Actionscript EventBus in v1.1 is still implemented as a singleton, version 1.2 will make use of the as3commons-eventbus which also offers event interceptors etc.

    cheers,

    Roland

    Comment

    Working...
    X