14. Step1. work with Queue
.......
log = getLog(request)
channel.publish(None,‘log-queue’,None,log)
15. Step1. work with Queue
.......
log = getLog(request)
channel.publish(None,‘log-queue’,None,log)
def onLog(log):
if log.type == ‘login’:
# balabala
if log.type == ‘logout’:
# balabala
log.save()
16. Step1. work with Queue
.......
log = getLog(request)
channel.publish(None,‘log-queue’,None,log)
def onLog(log):
if log.type == ‘login’:
# balabala
if log.type == ‘logout’:
# balabala
log.save()
17. Step1. work with Queue
.......
log = getLog(request)
channel.publish(None,‘log-queue’,None,log)
def onLog(log):
if log.type == ‘login’:
yep. performance better now # balabala
but. that if log.type == ‘logout’:
codes still smell bad~~ # balabala
log.save()
35. clustering to scale
Check it out:
rabbit1$ rabbitmqctl status
Status of node rabbit@rabbit1 ...
[...,
{nodes,[{disc,[rabbit@rabbit1]},{ram,[rabbit@rabbit2]}]},
{running_nodes,[rabbit@rabbit2,rabbit@rabbit1]}]
...done.