Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between google.cloud.pubsub_v1 and google.cloud.pubsub?

I see both used in different documentation from Google:

from google.cloud import pubsub

Is found in:

  • https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/pubsub
  • https://googlecloudplatform.github.io/google-cloud-python/latest/pubsub/

Whereas

from google.cloud import pubsub_v1

Is find in:

  • https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/pubsub/cloud-client/subscriber.py
  • https://cloud.google.com/pubsub/docs/pull
like image 851
gunit Avatar asked Jan 10 '18 22:01

gunit


People also ask

What is Pub/Sub in Google cloud?

Google Cloud Pub/Sub provides messaging between applications. Cloud Pub/Sub is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a "topic" and other applications can subscribe to that topic to receive the messages.

What is the difference between pub Sub and Pub sub Lite?

Pub/Sub and Pub/Sub Lite are both horizontally scalable and managed messaging services. Pub/Sub is usually the default solution for most application integration and analytics use cases. Pub/Sub Lite is only recommended for applications where achieving extremely low cost justifies some additional operational work.

Is Google Pubsub a message queue?

Google Cloud Pub/Sub is a scalable, durable event ingestion and message delivery system that allows you to create an infrastructure whose responsibility is to handle message queues. Pub/Sub delivers low-latency, durable messaging by using two core components: topics and subscriptions.

Is Google Pubsub push or pull?

Push subscription The Pub/Sub server sends each message as an HTTPS request to the subscriber client at a pre-configured endpoint. This request is shown as a PushRequest in the image. The endpoint acknowledges the message by returning an HTTP success status code.


1 Answers

The google.cloud.pubsub library is designed to be make it easy to get the best performance out of a Cloud Pub/Sub publisher and subscriber. It has more advanced features such as message batching, asynchronous message delivery, and automatic ack deadline extension for messages not yet acknowledged by a subscriber. The API is different from the underlying Cloud Pub/Sub service API. For example, this library does not expose the pull method directly; messages are instead delivered to a callback passed into the subscriber's open method.

The google.cloud.pubsub_v1 library exposes the underlying API directly. It can be useful in specific cases where this level of control is necessary, e.g., when a synchronous subscriber is required in order to make requests in response to synchronous actions from a downstream dependency.

When possible, it is best to use the google.cloud.pubsub library.

like image 82
Kamal Aboul-Hosn Avatar answered Sep 28 '22 18:09

Kamal Aboul-Hosn