Skip to content

This example was developed using Python and just consume Cloud Pub/Sub msg of same GCP Project.

Notifications You must be signed in to change notification settings

kanjih-ciandt/endpoint-consumer-pub-sub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of consuming Cloud Pub/Sub message (#GaeStandardPython)

This example was developed using Python and just consume Cloud Pub/Sub msg of same GCP Project.

We are using Pull Subscriber

To include some messages in the topic you can use the GCloud:

gcloud init
gcloud components install beta
gcloud beta pubsub topics create <topic name>
gcloud beta pubsub subscriptions create --topic <topic name> <subscription name>
gcloud beta pubsub topics publish <topic name> <MSG>

Example:

gcloud init
gcloud components install beta
gcloud beta pubsub topics create myTopic
gcloud beta pubsub subscriptions create --topic myTopic mySubscription
gcloud beta pubsub topics publish myTopic "Hello"

ENVIRONMENT SETUP

Requirements

  • Python 2.7

Install Google Cloud SDK

Download the latest version of the SDK here: Google Cloud SDK After downloading the file, extract the content and run the install.sh script:

./google-cloud-sdk/install.sh

Then install the App Engine Python component:

gcloud components install app-engine-python

Install python dependencies

In the project's root folder:

pip install -r requirements.txt -t lib

Local runserver

In the project's root folder:

dev_appserver.py app.yaml

You should have your server up and running at localhost:8080. App Engine admin server is at localhost:8000.

Deployment

Then to deploy the application itself:

gcloud app deploy --<GCP PROJECT> -v <VERSION NAME> --no-promote app.yaml

About

This example was developed using Python and just consume Cloud Pub/Sub msg of same GCP Project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages