google.cloud.pubsub_v1.PublisherClient线程安全吗?
Is google.cloud.pubsub_v1.PublisherClient Thread safe?
我正在使用 google 云 PubSub,想知道 google.cloud.pubsub_v1.PublisherClient
是否线程安全。我是否需要将此对象的新实例传递给每个 threading.Thread
或者跨线程共享同一个实例是否安全?
这取决于您使用的客户端库。
This Python client library is not thread safe due to being built on top of the httplib2 library, which is not thread-safe. But, as the first link says, this is an old library. The newer Python library for Pub/Sub 是线程安全的。
其他 Google 客户端库也是 "thread safe"。例如,The .NET one 遵循所有静态成员都应该是线程安全的约定。
我正在使用 google 云 PubSub,想知道 google.cloud.pubsub_v1.PublisherClient
是否线程安全。我是否需要将此对象的新实例传递给每个 threading.Thread
或者跨线程共享同一个实例是否安全?
这取决于您使用的客户端库。
This Python client library is not thread safe due to being built on top of the httplib2 library, which is not thread-safe. But, as the first link says, this is an old library. The newer Python library for Pub/Sub 是线程安全的。
其他 Google 客户端库也是 "thread safe"。例如,The .NET one 遵循所有静态成员都应该是线程安全的约定。