Announcement Announcement Module
Collapse
No announcement yet.
Wiring Events Together Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wiring Events Together

    Hi everybody,

    My day job is normally Java/Spring development, so please forgive me if I've missed something completely.

    I've been using Mate for a while now, and a bit os SAS in another project ... I really like how a service layer can be configured with SAS ... it seems to fit really well with the Java/Spring style of wiring singletons together.

    What I like about Mate thou is how eventing stuff works ... i.e. i can listen to an event without caring where it came from ... thus avoiding having to wire to object together just to add an event listener between them.

    And with SAS im not sure if I can do this kind of event wiring ... or am I missing something so simple that nobody talks about it on the forums?

    If its not a simple feature, have people found a good way to use both Mate and SAS to get the best of both worlds?

    Cheers
    Steve

  • #2
    Hi Steve,

    0.8.1 does not support this but Christophe is working right now on a similar feature, I'm not sure it will make it for upcoming 0.9 but for sure it will be there for 1.0.

    Cheers

    Martino

    Comment


    • #3
      Hi Steve,

      like Martino said, I'm currently working on this feature. It will be metadata driven and you'll be able to listen for events by specifying a [EventHandler("someEvent")] annotation above the event handler function.

      Event dispatching happens via an event bus and you'll be able to dispatch bubbled events which will be picked up by the bus, or dispatch through to event bus directly.

      Is this the functionality you are looking for? If not, can you provide some input on how you would like it to be?

      regards,
      Christophe

      Comment


      • #4
        Sorry for late reply ... didn't realize a new message had been posted here

        That sounds like exactly what I'm after ... I like the idea of annotating the method, sounds like a clean way to reduce the dependency to "I depend on this event".

        If you need a beta tester for these features I'll be keen to lend a hand ... I have a bunch of code I've written where I can just replace the wiring I wrote about in the first post with this style of eventing.

        Steve

        Comment


        • #5
          Hi Steve,

          the code has been committed to SVN. Please check the EventHandlerMetaDataPostProcessor class for that. I'd be pleased if you would help to test this.

          I posted this to the dev group also. Here is the original message:

          ***
          I just added support for annotation/metadata configuration of event handlers
          for EventBus events. This allows you to listen for events simply by
          annotating a method with [EventHandler] metadata.

          To use this, you'll need to create an object definition for
          the EventHandlerMetaDataPostProcessor in the application context. You don't
          need to register the post processor explicitely since the container will
          pick it up if it has an object definition of that type.

          There are different possibilities in the usage of the [EventHandler]
          metadata. For more details please check the docs of
          the EventHandlerMetaDataPostProcessor class.
          ***

          regards,
          Christophe

          Comment


          • #6
            Cool so I just got it running with a simple event ...very nice

            Couple of pain points ...
            I had to check out and build from source, are there nightly builds (or similliar) available anywhere?

            The EventBus stuff ...
            I called EventBus.dispatchEvent(blah) in order for the handler to see the event ... and I might be dreaming but I thought I saw something mention that bubbling events would also make it to the event bus... Is there a way for normally dispatched events to reach the event bus?

            Cheers
            Steve

            Comment


            • #7
              Hi Steve,

              there are no nightlies available now, but we're checking with the SpringSource people to have a CI system set up.

              I did not add support for bubbling events, but it should not be much of a problem. Apart from removing the dependency on EventBus, I could not come up with good reasons to allow application events to dispatch through the display list. Can you provide some extra benefits that would make it worth to have this in Spring AS?

              regards,
              Christophe

              Comment


              • #8
                Cool,

                No I don't have a good reason for wanting display list events bubbled up, other than that I'd have to change a little bit less (my services already extend EventDispatcher and were send events via this).
                And thinking about it I reckon it would be cleaner and easier to understand just using the event bus. So I guess ignore that point, and I'll just migrate my stuff to using the EventBus.

                Cheers
                Steve

                Comment


                • #9
                  Hi, i'm trying EventHandler metadata too but it seems doesn't affect.
                  I follow the EventHandlerMetaDataPostProcessor docs but i think the problem is that the process() method is not executed.

                  In the app-context.xml i put this
                  PHP Code:
                  <object id="eventHandlerMetaDataPostProcessor" class="org.springextensions.actionscript.ioc.factory.config.EventHandlerMetaDataPostProcessor">
                  </
                  object
                  in the log i can read
                  - Singleton instantiated: 'eventHandlerMetaDataPostProcessor'

                  I miss something?
                  Thanks in advance

                  Comment


                  • #10
                    i found out the problem. A my incorrect app-context.xml configuration

                    [EventHandler] works fine!
                    thanks

                    Comment

                    Working...
                    X