本文整理汇总了Python中azure.servicebus.common.message.Message.enqueue_sequence_number方法的典型用法代码示例。如果您正苦于以下问题:Python Message.enqueue_sequence_number方法的具体用法?Python Message.enqueue_sequence_number怎么用?Python Message.enqueue_sequence_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.servicebus.common.message.Message
的用法示例。
在下文中一共展示了Message.enqueue_sequence_number方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pqueue_by_queue_client_conn_str_receive_handler_receiveanddelete
# 需要导入模块: from azure.servicebus.common.message import Message [as 别名]
# 或者: from azure.servicebus.common.message.Message import enqueue_sequence_number [as 别名]
def test_pqueue_by_queue_client_conn_str_receive_handler_receiveanddelete(live_servicebus_config, partitioned_queue):
queue_client = QueueClient.from_connection_string(
live_servicebus_config['conn_str'],
name=partitioned_queue,
debug=True)
with queue_client.get_sender() as sender:
for i in range(10):
message = Message("Handler message no. {}".format(i))
message.enqueue_sequence_number = i
sender.send(message)
messages = []
receiver = queue_client.get_receiver(mode=ReceiveSettleMode.ReceiveAndDelete, idle_timeout=5)
for message in receiver:
messages.append(message)
with pytest.raises(MessageAlreadySettled):
message.complete()
assert not receiver.running
assert len(messages) == 10
time.sleep(30)
messages = []
receiver = queue_client.get_receiver(mode=ReceiveSettleMode.ReceiveAndDelete, idle_timeout=5)
for message in receiver:
messages.append(message)
assert len(messages) == 0
示例2: test_pqueue_by_queue_client_conn_str_receive_handler_peeklock
# 需要导入模块: from azure.servicebus.common.message import Message [as 别名]
# 或者: from azure.servicebus.common.message.Message import enqueue_sequence_number [as 别名]
def test_pqueue_by_queue_client_conn_str_receive_handler_peeklock(live_servicebus_config, partitioned_queue):
queue_client = QueueClient.from_connection_string(
live_servicebus_config['conn_str'],
name=partitioned_queue,
debug=True)
with queue_client.get_sender() as sender:
for i in range(10):
message = Message("Handler message no. {}".format(i))
message.enqueue_sequence_number = i
sender.send(message)
receiver = queue_client.get_receiver(idle_timeout=5)
count = 0
for message in receiver:
print_message(message)
count += 1
message.complete()
assert count == 10