Пример #1
0
import sys
sys.path.append("../../src")

from rabbit import builder

server = {
    'host': 'localhost',
    'port': 5672,
    'user': '******',
    'pass': '******',
}

queue = builder.queue('queue', server)

queue.emit({'aaa': 1})
queue.emit({'aaa': 2})
queue.emit({'aaa': 3})
Пример #2
0
import sys
sys.path.append("../../src")

from rabbit import builder

server = {
    'host': 'localhost',
    'port': 5672,
    'user': '******',
    'pass': '******',
}

queueName = 'queue'
queue = builder.queue(queueName, server)


def onData(data):
    builder.exchange('process.log', server).emit("exchange.start", queueName)
    builder.exchange('process.log', server).emit("exchange.finish", queueName)


queue.receive(onData)
Пример #3
0
import sys
sys.path.append("../../src")

from rabbit import builder

server = {
    'host': 'localhost',
    'port': 5672,
    'user': '******',
    'pass': '******',
}

queue = builder.queue('queue.backend', server)

queue.emit({"aaa": 1})
queue.emit({"aaa": 2})
queue.emit({"aaa": 3})
Пример #4
0
import sys
sys.path.append("../../src")

from rabbit import builder

server = {
    'host': 'localhost',
    'port': 5672,
    'user': '******',
    'pass': '******',
}


def onData(data):
    print data['aaa']


builder.queue('queue.backend', server).receive(onData)