This is a demo modify from PubSub document for message publish and pull from a pull subscriber for 10 times. It also record the time cost for each process.
gcloud alpha pubsub topics create my-topic
gcloud alpha pubsub subscriptions create sub001 --topic my-topic
- publish.js: for publish 10 messages to topic 'my-topic'
- pull.js: for pull 10 times from subscriber:'sub001'
node publish.js
node pull.js