在 Azure ServiceBus 队列之间复制消息
Copy messages between Azure ServiceBus queues
如何将消息从一个 Azure ServiceBus 队列复制到另一个队列?
我们有一个队列,其中包含几千兆字节的消息,需要将这些消息从一个队列移动到另一个队列。如何使用 PowerShell 或 Dotnet 以编程方式或使用某种工具来实现这一点?
也许你可以创建一个 Azure service bus queue trigger function to copy message, you need to add service bus queue output binding。请参考我的代码示例:
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace FrankServiceBus
{
public static class Function1
{
[FunctionName("Function1")]
[return: ServiceBus("<your-queue-out>", Connection = "connectionString")]
public static String Run([ServiceBusTrigger("<your-queue-in>", Connection = "connectionString")]string myQueueItem, ILogger log)
{
log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
return myQueueItem;
}
}
}
如果您对Azure功能不熟悉,请参考Getting started with Azure Functions。
如何将消息从一个 Azure ServiceBus 队列复制到另一个队列?
我们有一个队列,其中包含几千兆字节的消息,需要将这些消息从一个队列移动到另一个队列。如何使用 PowerShell 或 Dotnet 以编程方式或使用某种工具来实现这一点?
也许你可以创建一个 Azure service bus queue trigger function to copy message, you need to add service bus queue output binding。请参考我的代码示例:
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace FrankServiceBus
{
public static class Function1
{
[FunctionName("Function1")]
[return: ServiceBus("<your-queue-out>", Connection = "connectionString")]
public static String Run([ServiceBusTrigger("<your-queue-in>", Connection = "connectionString")]string myQueueItem, ILogger log)
{
log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
return myQueueItem;
}
}
}
如果您对Azure功能不熟悉,请参考Getting started with Azure Functions。