Пример #1
0
def start():
    beanstalk = beanstalkc.Connection(confManage.host(), confManage.port())
    beanstalk = beanstalkc.use()
    job = ""
    """
		produce在set消息时,必须指定消息体和consumer,队列名
		consumer负责解析消息		
	"""
    while job is not None:
        job = beanstalk.reserve(RESERVE_TIMEOUT)
        print job.body
Пример #2
0
#coding=utf-8
#!/bin/python
"""
=================================================================
 @FileName:   Sender
 @author  :   houbolin<*****@*****.**>
 @descrption: 添加任务到队列中
 @
=================================================================
"""
import beanstalkc
import logging
import logging.handlers
import os
import sys
import confManage
#
#添加任务
#添加任务时,要求指定队列名
#
def addTask( queuename,msg ):
	beanstalk.use( queuename )
	beanstalk.put( msg )

if __name__ == '__main__':
	beanstalk = beanstalkc.Connection( confManage.host(),confManage.port() )