Version: v2
Installation
#
Requirements- Node.js version >= 12.22.0 or above (which can be checked by running node -v). You can use nvm for managing multiple Node versions on a single machine installed
#
Install#
From NPMOr
#
From Github Package RepositoryWe also publish to Github Package Repository as @deliveryhero/pubsub
. To install from there, first add this to your .npmrc
:
Or for .yarnrc
:
And then install the package.
OR
#
Project structureThe framework expects that you've created a pubsub directory in your project with the following structure:
#
Environment Variables/CLI ArgsThe framework expects the following environment variables. They can be added to the .env
file or passed through CLI args.
CLI Argument | Env Variable | Description |
---|---|---|
root-dir | PUBSUB_ROOT_DIR | must be the path to your project's pubsub directory. |
google-application-credentials | GOOGLE_APPLICATION_CREDENTIALS | see https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account to generate this |
project-id | GOOGLE_CLOUD_PROJECT | the project-id in Google Cloud Platform |
labels | GOOGLE_CLOUD_LABELS | Labels in stringified JSON format |
server-port | PUBSUB_SERVER_PORT | PORT at which the pubsub should run the server at |
health-server | PUBSUB_HEALTH_SERVER | If value assigned is true this would run a server showing health state and return 500 if not healthy |
Read more in CLI docs
#
What next?- Once the directory structure has been defined and environment variables set
- Then you can create subscriptions and topics
- Initialize your database connection, define project-level subscription defaults, and register subscriptions in the Subscription Service.
- After a service has been created, use the CLI to start the subscriptions server.