core.event_bus
index

# Copyright 2011 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

 
Classes
       
__builtin__.object
EventBus
Message
org.vertx.java.core.Handler(java.lang.Object)
org.python.proxies.core.event_bus$InternalHandler$0(org.vertx.java.core.Handler, java.lang.Object)
InternalHandler

 
class EventBus(__builtin__.object)
    This class represents a distributed lightweight event bus which can encompass multiple vert.x instances.
It is very useful for otherwise isolated vert.x application instances to communicate with each other.
 
Messages sent over the event bus are JSON objects represented as Ruby Hash instances.
 
The event bus implements a distributed publish / subscribe network.
 
Messages are sent to an address.
 
There can be multiple handlers registered against that address.
Any handlers with a matching name will receive the message irrespective of what vert.x application instance and
what vert.x instance they are located in.
 
All messages sent over the bus are transient. On event of failure of all or part of the event bus messages
may be lost. Applications should be coded to cope with lost messages, e.g. by resending them, and making application
services idempotent.
 
The order of messages received by any specific handler from a specific sender will match the order of messages
sent from that sender.
 
When sending a message, a reply handler can be provided. If so, it will be called when the reply from the receiver
has been received.
 
When receiving a message in a handler the received object is an instance of EventBus::Message - this contains
the actual Hash of the message plus a reply method which can be used to reply to it.
 
  Static methods defined here:
convert_msg(message)
java_eventbus()
publish(address, message)
Publish a message on the event bus
 
Keyword arguments:
@param address: the address to publish to
@param message: The message to publish
register_handler(address, local_only=False, handler=None)
Register a handler.
 
Keyword arguments:
@param address: the address to register for. Any messages sent to that address will be
received by the handler. A single handler can be registered against many addresses.
@param local_only: if True then handler won't be propagated across cluster
@param handler: The handler
 
@return: id of the handler which can be used in EventBus.unregister_handler
register_simple_handler(local_only=False, handler=None)
Registers a handler against a uniquely generated address, the address is returned as the id
received by the handler. A single handler can be registered against many addresses.
 
Keyword arguments:
@param local_only: If Rrue then handler won't be propagated across cluster
@param handler: The handler
 
@return: id of the handler which can be used in EventBus.unregister_handler
send(address, message, reply_handler=None)
Send a message on the event bus
 
Keyword arguments:
@param address: the address to publish to
@param message: The message to send
@param reply_handler: An optional reply handler.
It will be called when the reply from a receiver is received.
send_or_pub(send, address, message, reply_handler=None)
unregister_handler(handler_id)
Unregisters a handler
 
Keyword arguments:
@param handler_id: the id of the handler to unregister. Returned from EventBus.register_handler

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
handler_dict = {}

 
class InternalHandler(org.python.proxies.core.event_bus$InternalHandler$0)
    
Method resolution order:
InternalHandler
org.python.proxies.core.event_bus$InternalHandler$0
org.vertx.java.core.Handler
java.lang.Object
__builtin__.object

Methods defined here:
__init__(self, handler)
handle(self, message)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__initProxy__ = <java function __initProxy__ 0x3>
__supernames__ = array('java.lang.String', [u'clone', u'finalize'])
classDictInit = <java function classDictInit 0x4>
clone = <java function clone 0x5>
finalize = <java function finalize 0x6>

Methods inherited from java.lang.Object:
__copy__(...)
__deepcopy__(...)
__eq__(...)
__hash__(...)
__ne__(...)
__repr__(...)
__unicode__(...)

Data and other attributes inherited from java.lang.Object:
equals = <java function equals 0x7>
getClass = <java function getClass 0x8>
hashCode = <java function hashCode 0x9>
notify = <java function notify 0xa>
notifyAll = <java function notifyAll 0xb>
toString = <java function toString 0xc>
wait = <java function wait 0xd>

 
class Message(__builtin__.object)
    Represents a message received from the event bus
 
  Methods defined here:
__init__(self, message)
reply(self, reply, handler=None)
Reply to this message. If the message was sent specifying a receipt handler, that handler will be
called when it has received a reply. If the message wasn't sent specifying a receipt handler
this method does nothing.
Replying to a message this way is equivalent to sending a message to an address which is the same as the message id
of the original message.
 
Keyword arguments:
@param reply: message to send as reply
@param handler: the reply handler

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        __author__ = 'Scott Horn'
__credits__ = 'Based entirely on work by Tim Fox http://tfox.org'
__email__ = 'scott@hornmicro.com'
java = <java package java 0xe>
org = <java package org 0x2>

 
Author
        Scott Horn

 
Credits
        Based entirely on work by Tim Fox http://tfox.org