modify alert sql
This commit is contained in:
parent
9ae084ee6e
commit
b9165de6b2
|
@ -142,17 +142,17 @@ def seek_offset(consumer):
|
|||
raise err
|
||||
# ANCHOR_END: assignment
|
||||
|
||||
|
||||
# ANCHOR: unsubscribe
|
||||
def unsubscribe(consumer):
|
||||
# ANCHOR: unsubscribe
|
||||
try:
|
||||
consumer.unsubscribe()
|
||||
print("Consumer unsubscribed successfully.");
|
||||
except Exception as err:
|
||||
print(f"Failed to unsubscribe consumer. ErrMessage:{err}")
|
||||
|
||||
|
||||
# ANCHOR_END: unsubscribe
|
||||
finally:
|
||||
if consumer:
|
||||
consumer.close()
|
||||
# ANCHOR_END: unsubscribe
|
||||
|
||||
if __name__ == "__main__":
|
||||
consumer = None
|
||||
|
@ -162,9 +162,10 @@ if __name__ == "__main__":
|
|||
subscribe(consumer)
|
||||
seek_offset(consumer)
|
||||
commit_offset(consumer)
|
||||
unsubscribe(consumer)
|
||||
consumer.unsubscribe()
|
||||
print("Consumer unsubscribed successfully.");
|
||||
except Exception as err:
|
||||
print(f"Failed to stmt consumer. ErrMessage:{err}")
|
||||
finally:
|
||||
if consumer:
|
||||
consumer.close()
|
||||
consumer.unsubscribe()
|
||||
|
||||
|
|
|
@ -143,14 +143,17 @@ def commit_offset(consumer):
|
|||
|
||||
# ANCHOR_END: commit_offset
|
||||
#
|
||||
# ANCHOR: unsubscribe
|
||||
|
||||
def unsubscribe(consumer):
|
||||
# ANCHOR: unsubscribe
|
||||
try:
|
||||
consumer.unsubscribe()
|
||||
print("Consumer unsubscribed successfully.");
|
||||
except Exception as err:
|
||||
print(f"Failed to unsubscribe consumer. ErrMessage:{err}")
|
||||
|
||||
finally:
|
||||
if consumer:
|
||||
consumer.close()
|
||||
|
||||
# ANCHOR_END: unsubscribe
|
||||
|
||||
|
@ -161,10 +164,8 @@ if __name__ == "__main__":
|
|||
consumer = create_consumer()
|
||||
subscribe(consumer)
|
||||
seek_offset(consumer)
|
||||
commit_offset(consumer)
|
||||
unsubscribe(consumer)
|
||||
commit_offset(consumer)
|
||||
except Exception as err:
|
||||
print(f"Failed to stmt consumer. ErrorMessage:{err}")
|
||||
finally:
|
||||
if consumer:
|
||||
consumer.close()
|
||||
unsubscribe(consumer);
|
Loading…
Reference in New Issue