Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pluralsight/gcp-pubsub-lite

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pluralsight/gcp-pubsub-lite - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

2

package.json
{
"name": "@pluralsight/gcp-pubsub-lite",
"version": "1.0.13",
"version": "1.0.14",
"description": "Convenience wrapper for GCP Pub/Sub",

@@ -5,0 +5,0 @@ "main": "src/pubsub.js",

@@ -23,21 +23,21 @@ # gcp-pubsub-lite

const gcpPubSub = require("@google-cloud/pubsub");
const pubsub = require("@pluralsight/gcp-pubsub-lite");
const psLite = require("@pluralsight/gcp-pubsub-lite");
const {GCP_PROJECT_ID: gcpProjectId} = process.env;
pubsub.setup(gcpPubSub, gcpProjectId);
psLite.setup(gcpPubSub, gcpProjectId);
const topicName = "topicName";
await pubsub.createTopic(topicName);
await psLite.createTopic(topicName); // idempotent
const subName = "subName";
await pubsub.createSubscription(topicName, subName);
await psLite.createSubscription(topicName, subName); // idempotent
const messageData = {test: true, count: 5, data: "foobar", pi: 3.14};
await pubsub.publishJson(topicName, messageData);
let isPolling = true
await psLite.publishJson(topicName, messageData);
let isPolling = true;
while (isPolling) {
let envelopes = []
envelopes = await pubsub.pull(subName, 1);
const envelopes = await psLite.pull(subName, 1);
if (!envelopes.length) {
// wait 500ms and try again
await new Promise(resolve => setTimeout(resolve, 500));

@@ -48,10 +48,11 @@ continue;

const {message, ackId} = envelope;
const copyOfMessageData = pubsub.jsonifyMessageData(message);
const copyOfMessageData = psLite.jsonifyMessageData(message);
console.log("message", copyOfMessageData);
await pubsub.acknowledge(subName, [ackId]);
console.log("message contains:", copyOfMessageData);
await psLite.acknowledge(subName, [ackId]);
isPolling = false;
}
await Promise.all([pubsub.deleteSubscription(subName),
pubsub.deleteTopic(topicName)]);
await Promise.all([psLite.deleteSubscription(subName),
psLite.deleteTopic(topicName)]);

@@ -58,0 +59,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc