简体   繁体   中英

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:

Whereas

from google.cloud import pubsub_v1

Is find in:

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, eg, 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM