Adjust samples to handle the deregistration event without an exception.
This commit is contained in:
parent
ec2f82ca95
commit
481371fb50
@ -24,8 +24,15 @@ import SampleEnv
|
||||
import threading
|
||||
import time
|
||||
|
||||
registered = True
|
||||
|
||||
def callback(message):
|
||||
global registered
|
||||
print("Message type:", message.type)
|
||||
if message.type == cx_Oracle.EVENT_DEREG:
|
||||
print("Deregistration has taken place...")
|
||||
registered = False
|
||||
return
|
||||
print("Message database name:", message.dbname)
|
||||
print("Message tables:")
|
||||
for table in message.tables:
|
||||
@ -52,7 +59,7 @@ print("--> Operations:", sub.operations)
|
||||
print("--> Rowids?:", bool(sub.qos & cx_Oracle.SUBSCR_QOS_ROWIDS))
|
||||
sub.registerquery("select * from TestTempTable")
|
||||
|
||||
while True:
|
||||
while registered:
|
||||
print("Waiting for notifications....")
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
@ -24,8 +24,15 @@ import SampleEnv
|
||||
import threading
|
||||
import time
|
||||
|
||||
registered = True
|
||||
|
||||
def callback(message):
|
||||
global registered
|
||||
print("Message type:", message.type)
|
||||
if message.type == cx_Oracle.EVENT_DEREG:
|
||||
print("Deregistration has taken place...")
|
||||
registered = False
|
||||
return
|
||||
print("Message database name:", message.dbname)
|
||||
print("Message queries:")
|
||||
for query in message.queries:
|
||||
@ -56,7 +63,7 @@ print("--> Rowids?:", bool(sub.qos & cx_Oracle.SUBSCR_QOS_ROWIDS))
|
||||
queryId = sub.registerquery("select * from TestTempTable")
|
||||
print("Registered query:", queryId)
|
||||
|
||||
while True:
|
||||
while registered:
|
||||
print("Waiting for notifications....")
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user