nit*_*igo 2 servicebus azure azureservicebus brokeredmessage
我有一个应用程序,其中数据从SQL DB获取并作为代理消息发送到服务总线.这些是步骤:
这是我面临的第三步.这是代码:
public async Task SendMessagesAsync(List<BrokeredMessage> brokeredMessageList)
{
try
{
var topicClient = CreateTopicClient();
await topicClient.SendBatchAsync(brokeredMessageList);
}
catch(Exception ex)
{
throw ex;
}
}
Run Code Online (Sandbox Code Playgroud)
当编译器使用SendBatchAsync方法时,它会在与Service Bus通信期间出现Error错误.检查连接信息,然后重试.内部例外是:
Internal Server Error: The server did not provide a meaningful reply; this might be caused by a premature session shutdown. TrackingId:some guid here
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试发送100条消息,它可以正常工作.我该怎么做才能让它一次发送1000条消息?
注意:每条消息大小为1445字节
遗憾的是,您不能,因为您的总有效负载大小约为1.4 MB(1445字节*1000),而允许的批处理的最大大小为256 KB.
参考:https://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.topicclient.sendbatch.aspx(备注部分)
批处理的最大大小与单个消息的最大大小(当前为256 Kb)相同.
我想你需要将批次进一步拆分成更小的批次,这样你就不会超过256K的限制.
| 归档时间: |
|
| 查看次数: |
3473 次 |
| 最近记录: |