-
Notifications
You must be signed in to change notification settings - Fork 922
Open
Labels
code:pythonIssues that are specific to Python or versions of Python independent of library logicIssues that are specific to Python or versions of Python independent of library logicmaintenanceAny tech debt or routine action tasks that should be tracked with an issueAny tech debt or routine action tasks that should be tracked with an issuepriority:highMaintainer triage tag for indicating high impact or criticality issuesMaintainer triage tag for indicating high impact or criticality issues
Description
Description
This is an enhancement request to make it easier to write tests for user code that uses this client library. In unit tests, it would useful to be create synthetic Message
instances without having to read them from a live Kafka cluster with a Consumer
.
The current implementation of the Message
type does not make it possible to instantiate a Message
because the PyTypeObject MessageType
definition does not specify the tp_new
and tp_init
fields.
In contrast, the TopicPartitionType
definition does specify these fields, and we can instantiate a TopicPartition
.
How to reproduce
Using confluent-kafka-python v2.0.2, I observe the following when I try to call the __init__
method of Message
:
>>> import confluent_kafka
>>> confluent_kafka.Message()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot create 'cimpl.Message' instances
joaoe, ouphi, ycytai, jack-mcivor, HugoJP1 and 28 more
Metadata
Metadata
Assignees
Labels
code:pythonIssues that are specific to Python or versions of Python independent of library logicIssues that are specific to Python or versions of Python independent of library logicmaintenanceAny tech debt or routine action tasks that should be tracked with an issueAny tech debt or routine action tasks that should be tracked with an issuepriority:highMaintainer triage tag for indicating high impact or criticality issuesMaintainer triage tag for indicating high impact or criticality issues