This fixes issue #1 #2

Open
j wants to merge 123 commits from Branch_Karen into main
Showing only changes of commit d72087ac9f - Show all commits
+12
View File
@@ -1,6 +1,7 @@
from google.cloud import pubsub_v1
from google.oauth2 import service_account
import os
import asyncio
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "C:/Users/Karen/AppData/Roaming/gcloud/application_default_credentials.json"
project_id = "fp-20230425"
@@ -45,9 +46,20 @@ publisher.publish(topic_path, data=message)
print("Message published.")
async def receive_messages():
response = subscriber.pull(subscription=subscription_path, max_messages=1)
for received_message in response.received_messages:
print("Received message: {}".format(received_message.message.data))
asyncio.run(receive_messages())
'''
# Pull the message from the subscription
response = subscriber.pull(subscription=subscription_path, max_messages=1)
for received_message in response.received_messages:
print("Received message: {}".format(received_message.message.data))
# Acknowledge the message to mark it as processed
subscriber.acknowledge(subscription_path, [received_message.ack_id])
'''