If you add your EventXXXX in your _EVENTS list of your RyuApp that calls 
send_event_to_observers, it would to be OK.
 

Best Regards,
Haixiang YANG

From: [email protected]
To: [email protected]
Date: Sat, 1 Aug 2015 11:42:17 +0800
Subject: [Ryu-devel] How to register observes for  self-defined event?

To  whom it may concern,
      I try to generate a self-defined event in Ryu. What I have done shows 
below,      1. define a xxx_event.py and define a EventXXXX in this file.      
2. In a Ryu app, import xxx_event. Call the self.send_event_to_observers(ev, 
self.state)      3. In another Ryu app,  decorated a method by 
@set_ev_handler(xxx_event.EventXXXX, state)
      However, I run the apps and return nothing.      I really generate a 
event which defined by me, and call the method:send_event_to_observers.      I 
found that the observers of my event is empty, so the event can't be pushed in 
the Queue.            How should I do to register the observer?             If 
I add the code below to call handles, the event will be handled, because I 
handle the event directly.
        dispatchers = lambda x: x.callers[ev.__class__].dispatchers        
handlers = [handler for handler in                    
self.oxp_brick.get_handlers(ev) if                    MAIN_DISPATCHER in 
dispatchers(handler)]        for handler in handlers:            handler(ev)

      Thanks for your time.      I look forward to your reply.
      Best Regards.
------------------Distance 李呈
_____________________________________________________School of Information and 
Communication EngineeringBeijing University of Posts and 
TelecommunicationsBeijing 100876, PR 
China北京邮电大学・信息与通信工程学院・通信工程_____________________________________________________Mobile
 Phone: (+86) 151-1698-3550 Beijing 
E-mail:[email protected]@gmail.comHomepage:http://www.muzixing.com

 
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel                          
          
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to