Azure: How to move messages from poison queue to back to main queue?

前端 未结 7 1870
慢半拍i
慢半拍i 2020-12-30 06:57

I\'m wondering if there is a tool or lib that can move messages between queues? Currently, i\'m doing something like below

public static void ProcessQueueMes         


        
7条回答
  •  佛祖请我去吃肉
    2020-12-30 07:39

    Here's a python script you may find useful. You'll need to install azure-storage-queue

    queueService = QueueService(connection_string = "YOUR CONNECTION STRING")
    for queue in queueService.list_queues():
      if "poison" in queue.name:
        print(queue.name)
        targetQueueName = queue.name.replace("-poison", "")
        while queueService.peek_messages(queue.name):
          for message in queueService.get_messages(queue.name, 32):
            print(".", end="", flush=True)
            queueService.put_message(targetQueueName, message.content)
            queueService.delete_message(queue.name, message.id, message.pop_receipt)
    

提交回复
热议问题