You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/22 09:40:58 UTC

[GitHub] [pulsar] kyky19831214 created a discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

GitHub user kyky19831214 created a discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

the pulsar-client version is 2.9.2,
using the same parameter , consumer is ok but reader throws exception when I create them.
for help.


![image](https://user-images.githubusercontent.com/3140641/191713904-a0e3a9e5-479d-47a6-b9a0-c0edb9406bf3.png)


![image](https://user-images.githubusercontent.com/3140641/191714114-506462e1-f5cb-44f8-96c0-f59b92e474db.png)


GitHub link: https://github.com/apache/pulsar/discussions/17800

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] shibd added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user shibd added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

@kyky19831214 Hi, Can you provide your reproduce code?

GitHub link: https://github.com/apache/pulsar/discussions/17800#discussioncomment-3715895

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] kyky19831214 added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user kyky19831214 added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

It has been added.

GitHub link: https://github.com/apache/pulsar/discussions/17800#discussioncomment-3718005

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] kyky19831214 edited a discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user kyky19831214 edited a discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

the pulsar-client version is 2.9.2,
using the same parameter , consumer is ok but reader throws exception when I create them.
I change to java creating "reader", that is ok, I don`t know why python not work.
for help.


![image](https://user-images.githubusercontent.com/3140641/191713904-a0e3a9e5-479d-47a6-b9a0-c0edb9406bf3.png)

```
2022-09-23 22:47:01.912 INFO  [0x17146f000] ConsumerImpl:222 | [persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo-partition-4, zs5, 4] Created consumer on broker [10.240.192.211:57906 -> 172.21.206.57:6650] 
2022-09-23 22:47:01.912 INFO  [0x17146f000] ConsumerImpl:222 | [persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo-partition-0, zs5, 0] Created consumer on broker [10.240.192.211:57906 -> 172.21.206.57:6650] 
2022-09-23 22:47:01.912 INFO  [0x17146f000] PartitionedConsumerImpl:301 | Successfully Subscribed to Partitioned Topic - persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo with - 6 Partitions.
2022-09-23 22:47:02.019 ERROR [0x17146f000] ClientImpl:231 | Topic reader cannot be created on a partitioned topic: persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/XXX/Library/Application Support/JetBrains/PyCharm2021.2/scratches/pulsar/client_lixiang_test.py", line 15, in <module>
    reader = client.create_reader(topic, MessageId.earliest)
  File "/Users/XXX/Library/Python/3.10/lib/python/site-packages/pulsar/__init__.py", line 847, in create_reader
    c._reader = self._client.create_reader(topic, start_message_id, conf)
_pulsar.OperationNotSupported: Pulsar error: OperationNotSupported
```

![image](https://user-images.githubusercontent.com/3140641/191714114-506462e1-f5cb-44f8-96c0-f59b92e474db.png)
```
serviceUrl = "XXX"
adminUrl = "XXX"
topic = "XXX"
token = "XXX"
subScripName = 'zs5'

client = Client(serviceUrl, authentication=AuthenticationToken(token))
consumer = client.subscribe(topic, subScripName)

reader = client.create_reader(topic, MessageId.earliest)
```

GitHub link: https://github.com/apache/pulsar/discussions/17800

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] merlimat added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user merlimat added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

@kyky19831214 You're creating a reader over a partitioned topic. You should create the reader on the individual partitions instead. 

You can get the list of partitions using `client.get_topic_partitions()`: https://pulsar.apache.org/api/python/2.10.1/pulsar.html#Client.get_topic_partitions

GitHub link: https://github.com/apache/pulsar/discussions/17800#discussioncomment-3718474

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] kyky19831214 edited a discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user kyky19831214 edited a discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

the pulsar-client version is 2.9.2,
using the same parameter , consumer is ok but reader throws exception when I create them.
I change to java creating "reader", that is ok, I don`t know why python not work.
for help.


![image](https://user-images.githubusercontent.com/3140641/191713904-a0e3a9e5-479d-47a6-b9a0-c0edb9406bf3.png)
2022-09-23 22:47:01.912 INFO  [0x17146f000] ConsumerImpl:222 | [persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo-partition-4, zs5, 4] Created consumer on broker [10.240.192.211:57906 -> 172.21.206.57:6650] 
2022-09-23 22:47:01.912 INFO  [0x17146f000] ConsumerImpl:222 | [persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo-partition-0, zs5, 0] Created consumer on broker [10.240.192.211:57906 -> 172.21.206.57:6650] 
2022-09-23 22:47:01.912 INFO  [0x17146f000] PartitionedConsumerImpl:301 | Successfully Subscribed to Partitioned Topic - persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo with - 6 Partitions.
2022-09-23 22:47:02.019 ERROR [0x17146f000] ClientImpl:231 | Topic reader cannot be created on a partitioned topic: persistent://autopilot-operation-platform/x01/autopilot-operation-platform-filter-iot-signal-canlog-x01-testtwo
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/XXX/Library/Application Support/JetBrains/PyCharm2021.2/scratches/pulsar/client_lixiang_test.py", line 15, in <module>
    reader = client.create_reader(topic, MessageId.earliest)
  File "/Users/XXX/Library/Python/3.10/lib/python/site-packages/pulsar/__init__.py", line 847, in create_reader
    c._reader = self._client.create_reader(topic, start_message_id, conf)
_pulsar.OperationNotSupported: Pulsar error: OperationNotSupported


![image](https://user-images.githubusercontent.com/3140641/191714114-506462e1-f5cb-44f8-96c0-f59b92e474db.png)
serviceUrl = "XXX"
adminUrl = "XXX"
topic = "XXX"
token = "XXX"
subScripName = 'zs5'

client = Client(serviceUrl, authentication=AuthenticationToken(token))
consumer = client.subscribe(topic, subScripName)

reader = client.create_reader(topic, MessageId.earliest)


GitHub link: https://github.com/apache/pulsar/discussions/17800

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] michaeljmarshall added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user michaeljmarshall added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

@kyky19831214 - would you consider editing your question so that it has text instead of screen shots? Text is much easier to find when searching for results with search engines. Thanks!

GitHub link: https://github.com/apache/pulsar/discussions/17800#discussioncomment-3713830

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] kyky19831214 added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user kyky19831214 added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

thank you very much.
I solved this problem.
according your advice, I change the topic to ' individual partitions',  the reader object  is created successfully.

GitHub link: https://github.com/apache/pulsar/discussions/17800#discussioncomment-3726220

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org


[GitHub] [pulsar] shibd added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

Posted by GitBox <gi...@apache.org>.
GitHub user shibd added a comment to the discussion: python pulsar-clinet create_reader causes "OperationNotSupported" exception

I will look at it.

GitHub link: https://github.com/apache/pulsar/discussions/17800#discussioncomment-3713673

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@pulsar.apache.org