apache / apache/pulsar-client-python

Cannot seek on partitioned topic

Offen
#213 3 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @BewareMyPower Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
75
Forks
53
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

As per https://github.com/apache/pulsar/issues/3643, it seems pulsar should support seeking on partitioned topics.

This functionality seems partially missing in the C++ and python clients.

# Reproduction

First, run a pulsar standalone instance:

```bash
docker run -it -p 6650:6650 -p 8080:8080 --tmpfs /pulsar/data apachepulsar/pulsar:3.1.0 bin/pulsar standalone
```

Ensure you have pulsar client and httpx dependencies, and then run the following code:

```python
import httpx
import pulsar

# Make the topic above with a single partition
r = httpx.put("http://localhost:8080/admin/v2/persistent/public/default/example/partitions", json=1)
r.raise_for_status()

client = pulsar.Client("pulsar://localhost:6650")
consumer = client.subscribe("persistent://public/default/example", "sub")

# Seek to the latest message, raises OperationNotSupported
consumer.seek(pulsar.MessageId.latest)
```

# Expected Behaviour

Seeking should work across partitions. A seek to latest should take you to latest across partitions. Seeking by a MessageId (which contains a partition number) should seek that partition.

Curiously, passing in an explicit integer timestamp doesn't raise this exception, which seems to disagree with the doco that seeking is just not supported.

# Workarounds

Is there any way in the provided python API to seek on a per-partition basis as a workaround?

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.