-
Notifications
You must be signed in to change notification settings - Fork 917
AvroConsumer for handling schema registry #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
550688d
5b88a9e
f8ec601
4bac7cd
21c0b64
badd3bb
9797fef
95a9dbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,6 +332,23 @@ static PyObject *Message_timestamp (Message *self, PyObject *ignore) { | |
self->timestamp); | ||
} | ||
|
||
static PyObject *Message_set_value (Message *self, PyObject *new_val) { | ||
if (self->value) | ||
Py_DECREF(self->value); | ||
self->value = new_val; | ||
Py_INCREF(self->value); | ||
|
||
Py_RETURN_NONE; | ||
} | ||
|
||
static PyObject *Message_set_key (Message *self, PyObject *new_key) { | ||
if (self->key) | ||
Py_DECREF(self->key); | ||
self->key = new_key; | ||
Py_INCREF(self->key); | ||
|
||
Py_RETURN_NONE; | ||
} | ||
|
||
static PyMethodDef Message_methods[] = { | ||
{ "error", (PyCFunction)Message_error, METH_NOARGS, | ||
|
@@ -391,6 +408,20 @@ static PyMethodDef Message_methods[] = { | |
" :rtype: (int, int)\n" | ||
"\n" | ||
}, | ||
{ "set_value", (PyCFunction)Message_set_value, METH_O, | ||
" Set the field 'Message.value' with new value.\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Document param and type, see an example here: |
||
" :param: object value: Message.value.\n" | ||
" :returns: None.\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing docstring saying what the method actually does |
||
" :rtype: None\n" | ||
"\n" | ||
}, | ||
{ "set_key", (PyCFunction)Message_set_key, METH_O, | ||
" Set the field 'Message.key' with new value.\n" | ||
" :param: object value: Message.key.\n" | ||
" :returns: None.\n" | ||
" :rtype: None\n" | ||
"\n" | ||
}, | ||
{ NULL } | ||
}; | ||
|
||
|
@@ -1217,7 +1248,7 @@ rd_kafka_conf_t *common_conf_setup (rd_kafka_type_t ktype, | |
Py_DECREF(ks); | ||
return NULL; | ||
} | ||
|
||
if (h->stats_cb) { | ||
Py_DECREF(h->stats_cb); | ||
h->stats_cb = NULL; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice, but maybe a bit excessive for an example, I just ment to print the exception string, something like:
print("Message deserialization failed for %s: %s" % (msg, e))