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