Created
August 11, 2023 19:27
-
-
Save elephantsneverforget/36947e290791cefdd0ec8ef10a4873e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {PubSub} = require('@google-cloud/pubsub'); | |
async function listenForMessages() { | |
const pubsub = new PubSub(); | |
const subscriptionName = 'elevar-event-subscription'; | |
const subscription = pubsub.subscription(subscriptionName); | |
const messageHandler = (message) => { | |
// Handle event | |
message.ack(); | |
}; | |
subscription.on('message', messageHandler); | |
} | |
listenForMessages(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment