intrigued_66
intrigued_66

Reputation: 17220

Google PubSub how to process seeked messages whilst streaming-pull messages

I'm trying to process messages returned by seek(timestamp) in Python.

I am subscribed to non-seek messages using streaming pull:

subscriber = pubsub_v1.SubscriberClient()
subscription_path = subscriber.subscription_path(project_id, subscription_id)
future = subscriber.subscribe(subscription_path, callback=callback())

with subscriber:
    try:
        future.result()
    except TimeoutError:
        future.cancel()

def callback(msg):
    msg.ack()

I found the SeekRequest object:

https://googleapis.dev/python/pubsub/2.4.0/types.html

I was expecting seek() to cause the replayed messages to be received by streaming pull again. However, instead there's a SeekResponse object.

Is it possible to divert the seeked messages to arrive via the streaming pull callback?

Upvotes: 0

Views: 604

Answers (1)

Kamal Aboul-Hosn
Kamal Aboul-Hosn

Reputation: 17161

The seek response does not contain any messages. In fact, it is an empty response. The RPC has a response so you can know if the seek had any errors such as being performed on a subscription that doesn't exist. Seek causes the replayed messages to be redelivered to subscribers as messages along the same path as regular delivery, e.g., receiving them via streaming pull again.

Upvotes: 1

Related Questions