kafka simple using
Project description
消息队列,基于 beanstalk
You can install pysubman from PyPI with
$ pip install pysubman
Version update
- 1.10.0 将 kafka 迁移到 beanstalk
Getting Started
Producer
#!/usr/bin/env python # coding=utf-8 import time import logging logging.basicConfig(level=logging.DEBUG) import pysubman class EMAIL(object): Tube = "t-101" Topic = "EMAIL" Info = [ ("TemplateUrl", "%s"), ("Params", "%s"), ] client = pysubman.Producer(beanstalkd_host="192.168.0.23:11300") while True: now_time = time.time() client.put(EMAIL, "baidu.com", "chaungwang: {}".format(now_time)) time.sleep(1)
Customer
#!/usr/bin/env python # coding=utf-8 import logging import pysubman logging.basicConfig(level=logging.DEBUG) service = pysubman.Service() @service.C(["EMAIL", "EMAIL.SEND_TEMPLATE"]) def handler_email_job(body): logging.warn(("body", body)) def main(): consumer = pysubman.Consumer( beanstalkd_host="192.168.0.23:11300", services=service).tube("t-101") consumer.run() if __name__ == "__main__": main()
TODO
- 根据不同的环境,用户选择不同的slave
- add retry connecting(bug: interactive_timeout)
- add is_auto_allocation(Automatic Identification master and slave)
- Thread Safety
Support
If you need help using pymysqlslave or have found a bug, please open a github issue.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size pysubman-1.10.1-py2.7.egg (10.4 kB) | File type Egg | Python version 2.7 | Upload date | Hashes View |
Filename, size pysubman-1.10.1.tar.gz (4.2 kB) | File type Source | Python version None | Upload date | Hashes View |