Skip to content

Commit 438c885

Browse files
Correct calculation of MessageProperties.msgid.
1 parent 1347b04 commit 438c885

File tree

4 files changed

+9
-28
lines changed

4 files changed

+9
-28
lines changed

doc/src/api_manual/aq.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ Message Properties
321321

322322
.. attribute:: MessageProperties.msgid
323323

324-
This attribute specifies the id of the message in the last queue that
325-
generated this message.
324+
This read-only attribute specifies the id of the message in the last queue
325+
that enqueued or dequeued the message. If the message has never been
326+
dequeued or enqueued, the value will be `None`.
326327

327328

328329
.. attribute:: MessageProperties.payload

doc/src/release_notes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Version 8.3 (TBD)
1313
#) Updated embedded ODPI-C to `version 4.3.0
1414
<https://oracle.github.io/odpi/doc/releasenotes.html#
1515
version-4-3-tbd>`__.
16+
#) Corrected calculation of attribute :data:`MessageProperties.msgid`.
1617
#) Binary integer variables now explicitly convert values to integers (since
1718
implicit conversion to integer has become an error in Python 3.10) and
1819
values that are not `int`, `float` or `decimal.Decimal` are explicitly

src/cxoMsgProps.c

+5-25
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ static PyObject *cxoMsgProps_getExpiration(cxoMsgProps *props, void *unused)
182182

183183

184184
//-----------------------------------------------------------------------------
185-
// cxoMsgProps_getOriginalMsgId()
186-
// Get the value of the expiration property.
185+
// cxoMsgProps_getMsgId()
186+
// Get the value of the msgid property.
187187
//-----------------------------------------------------------------------------
188-
static PyObject *cxoMsgProps_getOriginalMsgId(cxoMsgProps *props, void *unused)
188+
static PyObject *cxoMsgProps_getMsgId(cxoMsgProps *props, void *unused)
189189
{
190190
uint32_t valueLength;
191191
const char *value;
192192

193-
if (dpiMsgProps_getOriginalMsgId(props->handle, &value, &valueLength) < 0)
193+
if (dpiMsgProps_getMsgId(props->handle, &value, &valueLength) < 0)
194194
return cxoError_raiseAndReturnNull();
195195
if (!value)
196196
Py_RETURN_NONE;
@@ -285,25 +285,6 @@ static int cxoMsgProps_setExpiration(cxoMsgProps *props, PyObject *valueObj,
285285
}
286286

287287

288-
//-----------------------------------------------------------------------------
289-
// cxoMsgProps_setOriginalMsgId()
290-
// Set the value of the original message id property.
291-
//-----------------------------------------------------------------------------
292-
static int cxoMsgProps_setOriginalMsgId(cxoMsgProps *props, PyObject *valueObj,
293-
void *unused)
294-
{
295-
Py_ssize_t valueLength;
296-
char *value;
297-
298-
if (PyBytes_AsStringAndSize(valueObj, &value, &valueLength) < 0)
299-
return -1;
300-
if (dpiMsgProps_setOriginalMsgId(props->handle, value,
301-
(uint32_t) valueLength) < 0)
302-
return cxoError_raiseAndReturnInt();
303-
return 0;
304-
}
305-
306-
307288
//-----------------------------------------------------------------------------
308289
// cxoMsgProps_setPriority()
309290
// Set the value of the expiration property.
@@ -339,8 +320,7 @@ static PyGetSetDef cxoCalcMembers[] = {
339320
(setter) cxoMsgProps_setExceptionQ, 0, 0 },
340321
{ "expiration", (getter) cxoMsgProps_getExpiration,
341322
(setter) cxoMsgProps_setExpiration, 0, 0 },
342-
{ "msgid", (getter) cxoMsgProps_getOriginalMsgId,
343-
(setter) cxoMsgProps_setOriginalMsgId, 0, 0 },
323+
{ "msgid", (getter) cxoMsgProps_getMsgId, 0, 0, 0 },
344324
{ "priority", (getter) cxoMsgProps_getPriority,
345325
(setter) cxoMsgProps_setPriority, 0, 0 },
346326
{ "state", (getter) cxoMsgProps_getState, 0, 0, 0 },

test/test_2700_aq.py

-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ def test_2707_msg_props(self):
161161
self.__verify_attr(props, "expiration", 30)
162162
self.assertEqual(props.attempts, 0)
163163
self.__verify_attr(props, "priority", 1)
164-
self.__verify_attr(props, "msgid", b'mID')
165164
self.assertEqual(props.state, oracledb.MSG_READY)
166165
self.assertEqual(props.deliverymode, 0)
167166

0 commit comments

Comments
 (0)