Publisher and Subscriber for Google Pub/Sub
Here are the steps to use it:
- Clone or Download the source code
- Create a topic in Google's Pub/Sub
- Create Subscriber for the newly created Topic in Google's Pub/Sub
- Change configuration values in default.json and production.json based on your environment
- Set Google Application Credentials (GOOGLE_APPLICATION_CREDENTIALS) environment variable
- Create a Service Account with following Roles:
- Pub/Sub Publisher
- Pub/Sub Subscriber
- Logs Writer
- Run it using
npm run local
This would expose the server on http://localhost:8090
To Publish a message, POST to the Topic endpoint
To Subscribe for messages, make a GET request to the Subscribe endpoint