apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.2k stars 3.58k forks source link

Python - Exception: Pulsar error: IncompatibleSchema when trying to send message to Pulsar Topic #5003

Closed StormRyders closed 1 year ago

StormRyders commented 5 years ago

Describe the bug I am trying to create Pulsar Producer in Python and getting below exception: Exception: Pulsar error: IncompatibleSchema

To Reproduce import pulsar from pulsar import Client, AuthenticationTLS from pulsar.schema import * import jsonschema import json from enum import Enum

class Example(Record): a = String()

set the application specific cert and key file path

auth = AuthenticationTLS("//home/Pulsar-clickstream//canvas.cert.pem", "//home/Pulsar-clickstream//canvas.key-pk8.pem")

Each environment(Rocklin, Branchburg, AWS Non Prod/PLE/STG/PROD has its own service url

The path to tls trust cert file - ca.cert.pem

client = Client("pulsar+ssl://Pulsar-URL tls_trust_certs_file_path="//home//ca.cert.pem", tls_allow_insecure_connection=False, authentication=auth)

producer = client.create_producer( topic='persistent://my-topic', schema=JsonSchema(Example) )

Publish messages to the topic. NOTE: Change the loop as per your requirement

for i in range(10): producer.send(Example(a=i["user"]["vzid"])).encode('utf-8')

print(i["user"]["vzid"])

producer.close() client.close()

Expected behavior Message should be sent to the topic and consumer should be able to access it.

Desktop (please complete the following information): -CentOS 7

sijie commented 5 years ago

@StormRyders

sijie commented 4 years ago

@StormRyders Any updates?

tisonkun commented 1 year ago

Closed as no response. No news is good news :)