How to use the @google-cloud/pubsub.v1 function in @google-cloud/pubsub

To help you get started, we’ve selected a few @google-cloud/pubsub examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github billziss-gh / pmci / controller / index.js View on Github external
],
        "metadata":
        {
            "items":
            [
                {
                    "key": "startup-script",
                    "value": package.config.NETBSD_BUILDER_STARTX,
                },
            ],
        },
    },
}

const pubcli = new pubsub.v1.PublisherClient()
const subcli = new pubsub.v1.SubscriberClient()

exports.listener = (req, rsp) =>
{
    // check if the request has our secret
    if (req.query.secret != package.config.SECRET)
    {
        rsp.status(400).send("You don't know the password!")
        return
    }

    if (req.query.image === undefined ||
        req.query.token === undefined)
    {
        rsp.status(400).send("query: missing image or token")
        return
    }
github billziss-gh / pmci / controller / index.js View on Github external
},
        ],
        "metadata":
        {
            "items":
            [
                {
                    "key": "startup-script",
                    "value": package.config.NETBSD_BUILDER_STARTX,
                },
            ],
        },
    },
}

const pubcli = new pubsub.v1.PublisherClient()
const subcli = new pubsub.v1.SubscriberClient()

exports.listener = (req, rsp) =>
{
    // check if the request has our secret
    if (req.query.secret != package.config.SECRET)
    {
        rsp.status(400).send("You don't know the password!")
        return
    }

    if (req.query.image === undefined ||
        req.query.token === undefined)
    {
        rsp.status(400).send("query: missing image or token")
        return
github googleapis / nodejs-pubsub / samples / subscriptions.js View on Github external
async function synchronousPull(projectName, subscriptionName) {
  // [START pubsub_subscriber_sync_pull]
  // Imports the Google Cloud client library
  const pubsub = require('@google-cloud/pubsub');

  const client = new pubsub.v1.SubscriberClient();

  /**
   * TODO(developer): Uncomment the following lines to run the sample.
   */
  // const projectName = 'your-project';
  // const subscriptionName = 'your-subscription';

  const formattedSubscription = client.subscriptionPath(
    projectName,
    subscriptionName
  );
  // The maximum number of messages returned for this request.
  // Pub/Sub may return fewer than the number specified.
  const maxMessages = 1;
  const newAckDeadlineSeconds = 30;
  const request = {

@google-cloud/pubsub

Cloud Pub/Sub Client Library for Node.js

Apache-2.0
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis