visxu commented on issue #23661:
URL: https://github.com/apache/pulsar/issues/23661#issuecomment-2565196395
>
> I think the correct behavior should be to set the position to `latest`
when creating a subscription without a specified position, because the doc of
`HTTP PUT
/admin/v2/persistent/{tenant}/{namespace}/{topic}/subscription/{subscriptionName}`
is as follows: default value is `latest`
>
> ```java
> @ApiParam(name = "messageId", value = "messageId where to create the
subscription. "
> + "It can be 'latest', 'earliest' or (ledgerId:entryId)",
> defaultValue = "latest",
> allowableValues = "latest, earliest, ledgerId:entryId"
> )
> ```
Yes, I understand you. My point is that if customer create subscription only
with properties setting but no specified position, will get different results
between REST API and Admin cmd. Executing commands below, will get `earliest`
and `latest` subscriptions.
```shell
visxu➜~/pulsar-cluster-3.0.6» ./pulsar-1/bin/pulsar-admin topics
create-subscription --subscription sub-x-1 --property key1=value1
public/default/topic-x
visxu➜~/pulsar-cluster-3.0.6» curl --location --request PUT
'http://127.0.0.1:18080/admin/v2/persistent/public/default/topic-x/subscription/sub-x-2'
\ [8:40:03]
--header 'Content-Type: application/json' \
--data '{
"properties": {
"key2": "value2"
}
}'
```
I don't think it's correct. And by checking the REST API code, the request
body param class `ResetCursorData.java`, the field `ledgerId` and `entryId`
should be Long.MAX_VALUE if setting `latest` position.
So, I do suggest that change the `ledgerId` and `entryId` default value to
Long.MAX_VALUE. What's your opinion ?
<img width="619" alt="image"
src="https://github.com/user-attachments/assets/a6593639-c182-47f0-9fdd-52a932e7626b"
/>
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]