Added support for indicating if the subscription is still registered with the
database when a notification is received.
This commit is contained in:
parent
7b9ce90842
commit
980f3d491c
@ -107,6 +107,16 @@ Message Objects
|
|||||||
to the callback procedure specified when a subscription is created.
|
to the callback procedure specified when a subscription is created.
|
||||||
|
|
||||||
|
|
||||||
|
.. attribute:: Message.consumerName
|
||||||
|
|
||||||
|
This read-only attribute returns the name of the consumer which generated
|
||||||
|
the notification. It will be populated if the subscription was created with
|
||||||
|
the namespace :data:`cx_Oracle.SUBSCR_NAMESPACE_AQ` and the queue is a
|
||||||
|
multiple consumer queue.
|
||||||
|
|
||||||
|
.. versionadded:: 6.4
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: Message.dbname
|
.. attribute:: Message.dbname
|
||||||
|
|
||||||
This read-only attribute returns the name of the database that generated
|
This read-only attribute returns the name of the database that generated
|
||||||
@ -130,12 +140,13 @@ Message Objects
|
|||||||
.. versionadded:: 6.4
|
.. versionadded:: 6.4
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: Message.consumerName
|
.. attribute:: Message.registered
|
||||||
|
|
||||||
This read-only attribute returns the name of the consumer which generated
|
This read-only attribute returns whether the subscription which generated
|
||||||
the notification. It will be populated if the subscription was created with
|
this notification is still registered with the database. The subscription
|
||||||
the namespace :data:`cx_Oracle.SUBSCR_NAMESPACE_AQ` and the queue is a
|
is automatically deregistered with the database when the subscription
|
||||||
multiple consumer queue.
|
timeout value is reached or when the first notification is sent (when the
|
||||||
|
quality of service flag :data:`cx_Oracle.SUBSCR_QOS_DEREG_NFY` is used).
|
||||||
|
|
||||||
.. versionadded:: 6.4
|
.. versionadded:: 6.4
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ registered = True
|
|||||||
def callback(message):
|
def callback(message):
|
||||||
global registered
|
global registered
|
||||||
print("Message type:", message.type)
|
print("Message type:", message.type)
|
||||||
if message.type == cx_Oracle.EVENT_DEREG:
|
if not message.registered:
|
||||||
print("Deregistration has taken place...")
|
print("Deregistration has taken place...")
|
||||||
registered = False
|
registered = False
|
||||||
return
|
return
|
||||||
|
|||||||
@ -29,7 +29,7 @@ registered = True
|
|||||||
def callback(message):
|
def callback(message):
|
||||||
global registered
|
global registered
|
||||||
print("Message type:", message.type)
|
print("Message type:", message.type)
|
||||||
if message.type == cx_Oracle.EVENT_DEREG:
|
if not message.registered:
|
||||||
print("Deregistration has taken place...")
|
print("Deregistration has taken place...")
|
||||||
registered = False
|
registered = False
|
||||||
return
|
return
|
||||||
|
|||||||
@ -281,6 +281,7 @@ struct cxoMessage {
|
|||||||
PyObject *queries;
|
PyObject *queries;
|
||||||
PyObject *queueName;
|
PyObject *queueName;
|
||||||
PyObject *consumerName;
|
PyObject *consumerName;
|
||||||
|
int registered;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cxoMessageQuery {
|
struct cxoMessageQuery {
|
||||||
|
|||||||
@ -54,6 +54,7 @@ static PyMemberDef cxoMessageTypeMembers[] = {
|
|||||||
{ "queries", T_OBJECT, offsetof(cxoMessage, queries), READONLY },
|
{ "queries", T_OBJECT, offsetof(cxoMessage, queries), READONLY },
|
||||||
{ "queueName", T_OBJECT, offsetof(cxoMessage, queueName), READONLY },
|
{ "queueName", T_OBJECT, offsetof(cxoMessage, queueName), READONLY },
|
||||||
{ "consumerName", T_OBJECT, offsetof(cxoMessage, consumerName), READONLY },
|
{ "consumerName", T_OBJECT, offsetof(cxoMessage, consumerName), READONLY },
|
||||||
|
{ "registered", T_BOOL, offsetof(cxoMessage, registered), READONLY },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -406,6 +407,7 @@ static int cxoMessage_initialize(cxoMessage *messageObj,
|
|||||||
messageObj->subscription = subscription;
|
messageObj->subscription = subscription;
|
||||||
encoding = subscription->connection->encodingInfo.encoding;
|
encoding = subscription->connection->encodingInfo.encoding;
|
||||||
messageObj->type = message->eventType;
|
messageObj->type = message->eventType;
|
||||||
|
messageObj->registered = message->registered;
|
||||||
messageObj->dbname = cxoPyString_fromEncodedString(message->dbName,
|
messageObj->dbname = cxoPyString_fromEncodedString(message->dbName,
|
||||||
message->dbNameLength, encoding);
|
message->dbNameLength, encoding);
|
||||||
if (!messageObj->dbname)
|
if (!messageObj->dbname)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user