[![Build Status](https://travis-ci.org/debonzi/gc-event-system.svg?branch=master)](https://travis-ci.org/debonzi/gc-event-system)
[![PyPI](https://img.shields.io/pypi/v/gces.svg)](https://github.com/debonzi/gc-event-system)
[![PyPI](https://img.shields.io/pypi/pyversions/gces.svg)](https://github.com/debonzi/gc-event-system)
[![Coverage Status](https://coveralls.io/repos/github/debonzi/gc-event-system/badge.svg)](https://coveralls.io/github/debonzi/gc-event-system)
# GCES - Google Cloud Event System
## Goals
This project aims make it easier to have a global Event Publisher/Event Subscriber system to be used accross services.
## Architecture
![Architecture](docs/overview.svg)
## Quick Event Notification Example
```python
from gces import EventPublisher
ept = EventPublisher('gces')
ept.notify('SIGNUP_EVENT', {'user_id': 1234})
ept.notify('LOGIN_EVENT', {'user_id': 4321})
```
## Quick Event Subscription Example
```python
import time
from gces import (
EventSubscriber
)
def example_run_subscriber_function(data):
print("Data Received: {}".format(data))
TOPIC_NAME = 'gces'
SUBSCRIBER_NAME = 'gces_example'
es = EventSubscriber(TOPIC_NAME, SUBSCRIBER_NAME)
es.register_fsub('EXAMPLE_RUN_FUNCTION_PROCCESS' example_run_subscriber_function)
es.start()
if __name__ == '__main__':
try:
while True:
time.sleep(200)
except KeyboardInterrupt:
print('Bye!!!!')
```
## Google Cloud Credentials
* Create Credentials at [Google](https://console.cloud.google.com/apis/credentials/serviceaccountkey)
* export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/<credentials_file>.json
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共21个文件
py:13个
txt:4个
pkg-info:2个
资源分类:Python库 所属语言:Python 资源全名:gces-0.0.10a0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
gces-0.0.10a0.tar.gz (21个子文件)
gces-0.0.10a0
PKG-INFO 3KB
gces.egg-info
PKG-INFO 3KB
requires.txt 183B
SOURCES.txt 415B
top_level.txt 5B
dependency_links.txt 1B
setup.cfg 79B
setup.py 2KB
README.md 2KB
gces
tools.py 289B
sub_events.py 2KB
pub_events.py 735B
message.py 556B
__init__.py 113B
ext
pyramid
__init__.py 1KB
__init__.py 0B
celery
__init__.py 62B
publisher.py 2KB
publisher.py 1KB
serializer.py 1KB
subscriber.py 1KB
共 21 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功