Correct calculation of MessageProperties.msgid.

This commit is contained in:
Anthony Tuininga 2021-09-03 10:56:24 -06:00
parent 1347b04976
commit 438c885c20
4 changed files with 9 additions and 28 deletions

View File

@ -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

View File

@ -13,6 +13,7 @@ Version 8.3 (TBD)
#) Updated embedded ODPI-C to `version 4.3.0
<https://oracle.github.io/odpi/doc/releasenotes.html#
version-4-3-tbd>`__.
#) 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

View File

@ -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 },

View File

@ -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)