Esempio n. 1
0
def makeService(conf):
    mqService = client.makeService(conf)

    state = State(conf)
    reactor.callLater(0, subscribeToQueues, mqService.mqFactory, state)
    
    return mqService
Esempio n. 2
0
def makeService(conf):
    mqService = client.makeService(conf)

    state = State(conf)
    reactor.callLater(0, subscribeToQueues, mqService.mqFactory, state)

    return mqService
Esempio n. 3
0
def makeService(conf):
    mqService = client.makeService(conf)
    mqFactory = mqService.mqFactory

    processRequest = queue.returnResponse(
        defer_pipe.pipe([
            queue.keysInBody(['cluster', 'tasklet', 'conf']),
            forwardOrCreate(
                conf('www.url_prefix') + '/' +
                os.path.basename(conf('tasklets.tasklets_www')),
                conf('tasklets.tasklets_queue'), 'runTasklets', 1)
        ]))

    queue.subscribe(mqFactory, conf('tasklets.tasklets_www'),
                    conf('tasklets.concurrent_tasklets'),
                    queue.wrapRequestHandler(None, processRequest))

    processRunTasklet = defer_pipe.hookError(
        defer_pipe.pipe(
            [queue.keysInBody(['tasklet', 'conf']), handleRunTasklet]),
        queue.failureMsg)

    queue.subscribe(mqFactory, conf('tasklets.tasklets_queue'),
                    conf('tasklets.concurrent_tasklets'),
                    queue.wrapRequestHandlerTask(None, processRunTasklet))

    return mqService
Esempio n. 4
0
def makeService(conf):
    mqService = client.makeService(conf)
    mqFactory = mqService.mqFactory


    processRequest = queue.returnResponse(defer_pipe.pipe([queue.keysInBody(['cluster',
                                                                             'tasklet',
                                                                             'conf']),
                                                           forwardOrCreate(
                                                               conf('www.url_prefix') + '/' +
                                                               os.path.basename(conf('tasklets.tasklets_www')),
                                                               conf('tasklets.tasklets_queue'),
                                                               'runTasklets',
                                                               1)]))



    queue.subscribe(mqFactory,
                    conf('tasklets.tasklets_www'),
                    conf('tasklets.concurrent_tasklets'),
                    queue.wrapRequestHandler(None, processRequest))


    processRunTasklet = defer_pipe.hookError(defer_pipe.pipe([queue.keysInBody(['tasklet',
                                                                                'conf']),
                                                              handleRunTasklet]),
                                             queue.failureMsg)
    
    queue.subscribe(mqFactory,
                    conf('tasklets.tasklets_queue'),
                    conf('tasklets.concurrent_tasklets'),
                    queue.wrapRequestHandlerTask(None, processRunTasklet))
    
    
    return mqService
Esempio n. 5
0
def makeService(conf):
    mqService = client.makeService(conf)
    mqFactory = mqService.mqFactory

    state = State(conf)

    _subscribeToQueues(mqFactory, state)

    return mqService
Esempio n. 6
0
def makeService(conf):
    mqService = client.makeService(conf)
    mqFactory = mqService.mqFactory

    state = State(conf)

    defer.maybeDeferred(_subscribeToQueues, mqFactory, state)

    return mqService
Esempio n. 7
0
def makeService(conf):
    mqService = client.makeService(conf)
    mqFactory = mqService.mqFactory

    state = State(conf)

    _subscribeToQueues(mqFactory, state)
    
    return mqService
Esempio n. 8
0
def makeService(conf):
    ms = service.MultiService()
    
    mqService = client.makeService(conf)
    root = Root(mqService.mqFactory)
    vappio_cgi.addCGIDir(root, conf('legacy.cgi_dir'), filterF=lambda f : f.endswith('.py'))
    mqService.setServiceParent(ms)
    internet.TCPServer(int(conf('www.port')), server.Site(root)).setServiceParent(ms)
    
    return ms
Esempio n. 9
0
def makeService(conf):
    mqService = client.makeService(conf)

    mqFactory = mqService.mqFactory

    # State is currently not used, but kept around for future purposes
    state = State(conf)

    subscribeToQueues(mqFactory, state)

    return mqService
Esempio n. 10
0
def makeService(conf):
    mqService = client.makeService(conf)

    mqFactory = mqService.mqFactory

    # State is currently not used, but kept around for future purposes
    state = State(conf)

    subscribeToQueues(mqFactory, state)

    return mqService
Esempio n. 11
0
def makeService(conf):
    ms = service.MultiService()

    mqService = client.makeService(conf)
    root = Root(mqService.mqFactory)
    vappio_cgi.addCGIDir(root,
                         conf('legacy.cgi_dir'),
                         filterF=lambda f: f.endswith('.py'))
    mqService.setServiceParent(ms)
    internet.TCPServer(int(conf('www.port')),
                       server.Site(root)).setServiceParent(ms)

    return ms
Esempio n. 12
0
from vappio_tx.mq import client


def printIt(mq, m):
    print 'ACK', m.headers['message-id']
    print m.body
    mq.ack(m.headers['message-id'], headers={})

conf = config.configFromMap({'username': '',
                             'password': '',
                             'host': 'localhost',
                             'port': 61613})



application = service.Application('test')

s2 = client.makeService(conf)
s2.setServiceParent(application)
s2.mqFactory.subscribe(lambda m : printIt(s2.mqFactory, m), '/queue/inbox', {})

s1 = client.makeService(conf)
s1.setServiceParent(application)

def loopingCall():
    lc = task.LoopingCall(lambda : s1.mqFactory.send('/queue/inbox', {'ack-timeout': 60}, 'foo'))
    lc.start(0)

#reactor.callLater(1, loopingCall)
Esempio n. 13
0
from twisted.internet import reactor
from twisted.application import service

from twisted.internet import task

from igs.utils import config

from vappio_tx.mq import client

conf = config.configFromMap({'mq.username': '',
                             'mq.password': '',
                             'mq.host': 'localhost',
                             'mq.port': 61613})



application = service.Application('test')

s1 = client.makeService(conf)
s1.setServiceParent(application)

def loopingCall():
    lc = task.LoopingCall(lambda : s1.mqFactory.send('/queue/inbox', 'foo', {'ack-timeout': 60}))
    lc.start(0)

reactor.callLater(1, loopingCall)