Package pulp :: Package server :: Package event :: Module dispatcher :: Class EventDispatcher
[hide private]
[frames] | no frames]

Class EventDispatcher

source code

messaging.endpoint.Endpoint --+        
                              |        
    messaging.consumer.Consumer --+    
                                  |    
   messaging.consumer.EventConsumer --+
                                      |
                                     EventDispatcher

The main event dispatcher. Dispatches events by subject to the registered handler.

Instance Methods [hide private]
 
__init__(self) source code
 
start(self)
Start processing messages on the queue.
source code
 
raised(self, subject, event)
Entry point (callback) for received AMQP events.
source code
    Inherited from messaging.consumer.EventConsumer
 
dispatch(self, envelope)
Process received request.
source code
    Inherited from messaging.consumer.Consumer
str
address(self)
Get the AMQP address for this endpoint.
source code
str
id(self)
Get the endpoint id
source code
 
join(self)
Join the worker thread.
source code
 
open(self)
Open and configure the consumer.
source code
 
received(self, message)
Process received request.
source code
 
stop(self)
Stop processing requests.
source code
 
valid(self, envelope)
Check to see if the envelope is valid.
source code
    Inherited from messaging.endpoint.Endpoint
 
__del__(self) source code
 
__str__(self) source code
 
ack(self)
Acknowledge all messages received on the session.
source code
 
close(self)
Close (shutdown) the endpoint.
source code
Connection
connection(self)
Get cached connection based on url.
source code
qpid.messaging.Session
session(self)
Get a session for the open connection.
source code
Class Methods [hide private]
 
register(cls, entity, hclass, inbound, outbound)
Register a handler.
source code
 
load(cls)
Load handlers.
source code
tuple (inst,method)
handler(cls, entity, inbound=None, outbound=None)
Get a handler class associated with the specified entity.
source code
    Inherited from messaging.endpoint.Endpoint
 
shutdown(cls)
Shutdown all connections.
source code
Class Variables [hide private]
dict handlers = {}
Registered event handler classes.
    Inherited from messaging.endpoint.Endpoint
  LOCALHOST = 'tcp://localhost:5672'
Connection connectons
An AMQP connection.
Instance Variables [hide private]
    Inherited from messaging.endpoint.Endpoint
str uuid
The unique endpoint id.
Method Details [hide private]

__init__(self)
(Constructor)

source code 
Parameters:
  • subject - An (optional) event subject.
Overrides: messaging.endpoint.Endpoint.__init__
(inherited documentation)

start(self)

source code 

Start processing messages on the queue.

Overrides: messaging.consumer.Consumer.start
(inherited documentation)

register(cls, entity, hclass, inbound, outbound)
Class Method

source code 

Register a handler.

Parameters:
  • entity (str) - The entity name.
  • hclass - The handler class.
  • hclass - class
  • inbound (dict) - The inbound method mappings.
  • outbound (dict) - The outbound method mappings.

handler(cls, entity, inbound=None, outbound=None)
Class Method

source code 

Get a handler class associated with the specified entity.

Parameters:
  • entity (str) - The entity part of an AMQP subject.
  • inbound (str) - The inbound action.
  • outbound (str) - The outbound action.
Returns: tuple (inst,method)
The handler instance and method based on whether the inbound or outbound param is specified.

raised(self, subject, event)

source code 

Entry point (callback) for received AMQP events. The event is dispatched to the registered handler and the inbound method is called.

Parameters:
  • subject (str) - The event (message) subject used for routing.
  • event (dict) - The event payload.
Overrides: messaging.consumer.EventConsumer.raised

Class Variable Details [hide private]

handlers

Registered event handler classes. Key: entity.
Type:
dict
Value:
{}