Exemplo n.º 1
0
            }
            log.debug('RPCServer emit')
            self._event_engine.emit(Event(self.EVENT_SERVER, args))




if __name__ == '__main__':

    from eventengine import ZMQEventEngine
    import sys

    def print_hello(data):
        """""" 
        print "***************"
        print "print_hello" 
        print "args: ", data
        print "return: ", 123
        return "123"
    server_engine = ZMQEventEngine('test')
    server_engine.start()
    server = EventRPCServer(server_engine, 'test')
    server.register("print_hello", print_hello)

    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        server_engine.stop()
        sys.exit(0)
Exemplo n.º 2
0
            log.debug('RPCServer [%s] emit %s' %
                      (self._name, str(self.EVENT_FROM_SERVER)))
            #str(Event(self.EVENT_FROM_SERVER, args))))
            self._event_engine.emit(Event(self.EVENT_FROM_SERVER, args))


if __name__ == '__main__':

    from eventengine import ZMQEventEngine
    import sys

    def print_hello(data):
        """"""
        print "***************"
        print "print_hello"
        print "args: ", data
        print "return: ", 123
        return "123"

    server_engine = ZMQEventEngine('test')
    server_engine.start()
    server = EventRPCServer(server_engine, 'test')
    server.register("print_hello", print_hello)

    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        server_engine.stop()
        sys.exit(0)
Exemplo n.º 3
0
from rpc import EventRPCClient
from eventengine import ZMQEventEngine
import time
import sys



client_engine = ZMQEventEngine()
client_engine.start()
client = EventRPCClient(client_engine, 'test')
for i in xrange(0, 5):
    print "sync_call: print_hello "
    print "return: ", client.sync_call("print_hello",
                            { 'data': 'from_rpc_client' })
    time.sleep(1)
print "***************" 
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    client_engine.stop()
    sys.exit(0)
Exemplo n.º 4
0
from rpc import EventRPCClient
from eventengine import ZMQEventEngine
import time
import sys



client_engine = ZMQEventEngine('test')
client_engine.start()
client = EventRPCClient('test', client_engine, 'test')
for i in xrange(0, 5):
    print "sync_call: print_hello "
    print "return: ", client.sync_call("print_hello",
                            { 'data': 'from_rpc_client' })
    time.sleep(1)
print "***************" 
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    client_engine.stop()
    sys.exit(0)