diff --git a/doc/src/api_manual/aq.rst b/doc/src/api_manual/aq.rst index 1f66997..ad9c9e8 100644 --- a/doc/src/api_manual/aq.rst +++ b/doc/src/api_manual/aq.rst @@ -321,8 +321,9 @@ Message Properties .. attribute:: MessageProperties.msgid - This attribute specifies the id of the message in the last queue that - generated this message. + This read-only attribute specifies the id of the message in the last queue + that enqueued or dequeued the message. If the message has never been + dequeued or enqueued, the value will be `None`. .. attribute:: MessageProperties.payload diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index d960f9b..59e4a21 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -13,6 +13,7 @@ Version 8.3 (TBD) #) Updated embedded ODPI-C to `version 4.3.0 `__. +#) Corrected calculation of attribute :data:`MessageProperties.msgid`. #) Binary integer variables now explicitly convert values to integers (since implicit conversion to integer has become an error in Python 3.10) and values that are not `int`, `float` or `decimal.Decimal` are explicitly diff --git a/src/cxoMsgProps.c b/src/cxoMsgProps.c index 0e525fa..9ba0364 100644 --- a/src/cxoMsgProps.c +++ b/src/cxoMsgProps.c @@ -182,15 +182,15 @@ static PyObject *cxoMsgProps_getExpiration(cxoMsgProps *props, void *unused) //----------------------------------------------------------------------------- -// cxoMsgProps_getOriginalMsgId() -// Get the value of the expiration property. +// cxoMsgProps_getMsgId() +// Get the value of the msgid property. //----------------------------------------------------------------------------- -static PyObject *cxoMsgProps_getOriginalMsgId(cxoMsgProps *props, void *unused) +static PyObject *cxoMsgProps_getMsgId(cxoMsgProps *props, void *unused) { uint32_t valueLength; const char *value; - if (dpiMsgProps_getOriginalMsgId(props->handle, &value, &valueLength) < 0) + if (dpiMsgProps_getMsgId(props->handle, &value, &valueLength) < 0) return cxoError_raiseAndReturnNull(); if (!value) Py_RETURN_NONE; @@ -285,25 +285,6 @@ static int cxoMsgProps_setExpiration(cxoMsgProps *props, PyObject *valueObj, } -//----------------------------------------------------------------------------- -// cxoMsgProps_setOriginalMsgId() -// Set the value of the original message id property. -//----------------------------------------------------------------------------- -static int cxoMsgProps_setOriginalMsgId(cxoMsgProps *props, PyObject *valueObj, - void *unused) -{ - Py_ssize_t valueLength; - char *value; - - if (PyBytes_AsStringAndSize(valueObj, &value, &valueLength) < 0) - return -1; - if (dpiMsgProps_setOriginalMsgId(props->handle, value, - (uint32_t) valueLength) < 0) - return cxoError_raiseAndReturnInt(); - return 0; -} - - //----------------------------------------------------------------------------- // cxoMsgProps_setPriority() // Set the value of the expiration property. @@ -339,8 +320,7 @@ static PyGetSetDef cxoCalcMembers[] = { (setter) cxoMsgProps_setExceptionQ, 0, 0 }, { "expiration", (getter) cxoMsgProps_getExpiration, (setter) cxoMsgProps_setExpiration, 0, 0 }, - { "msgid", (getter) cxoMsgProps_getOriginalMsgId, - (setter) cxoMsgProps_setOriginalMsgId, 0, 0 }, + { "msgid", (getter) cxoMsgProps_getMsgId, 0, 0, 0 }, { "priority", (getter) cxoMsgProps_getPriority, (setter) cxoMsgProps_setPriority, 0, 0 }, { "state", (getter) cxoMsgProps_getState, 0, 0, 0 }, diff --git a/test/test_2700_aq.py b/test/test_2700_aq.py index 142790f..e8f3490 100644 --- a/test/test_2700_aq.py +++ b/test/test_2700_aq.py @@ -161,7 +161,6 @@ class TestCase(test_env.BaseTestCase): self.__verify_attr(props, "expiration", 30) self.assertEqual(props.attempts, 0) self.__verify_attr(props, "priority", 1) - self.__verify_attr(props, "msgid", b'mID') self.assertEqual(props.state, oracledb.MSG_READY) self.assertEqual(props.deliverymode, 0)