You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/03 11:06:25 UTC
[GitHub] [pulsar] zymap edited a comment on issue #9441: Creating subscription on a Topic via REST API sets the cursor to earliest position
zymap edited a comment on issue #9441:
URL: https://github.com/apache/pulsar/issues/9441#issuecomment-772374199
Hi @merajblueshift , I checkout the pulsar admin request, it sends a HTTP request like this:
```
PUT /admin/v2/persistent/public/default/test/subscription/test HTTP/1.1
Accept: application/json
Content-Type: application/json
content-length: 82
host: localhost:8088
user-agent: Pulsar-Java-v2.7.0
{"ledgerId":9223372036854775807,"entryId":9223372036854775807,"partitionIndex":-1}
```
As you see, it doesn't send a message position like `{"messageId": "latest"}`.
In pulsar admin, we convert the string `latest` to the `MessageId.latest` https://github.com/apache/pulsar/blob/fa41d02bebfd841767846240f3ae574047f118f0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/MessageId.java#L86
So actually, it passes a position ({"ledgerId":9223372036854775807,"entryId":9223372036854775807,"partitionIndex":-1}) to the broker with the REST API.
I think we should handle the position string like `earliest` and `latest` in the broker like how we did in the pulsar-admin client.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org