Google Cloud Event System.


Install
pip install gces==0.0.7a0

Documentation

Build Status PyPI PyPI Coverage Status

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

Quick Event Notification Example

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

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
  • export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/<credentials_file>.json