Azure ServiceBus: Client.Receive() returns null for messages > 64 KB

若如初见. 提交于 2019-12-11 10:36:11

问题


I'm using a BrokeredMessage containing a Stream with a serialized object. According to the documentation the stream is part of the body not the header which is restricted to 64 KB. The overall message with about 67 KB is well below the limit of 256 KB for the message-size of ServiceBus queues.

  1. I'm able to send a message and it shows up in the queue with the correct message-size.

  2. After issuing the Receive-command the packet is removed from the queue and the counter is decremented accordingly. But, the operation runs into a timeout and returns a null-pointer instead of the BrokeredMessage.

I've tried with a packet with a size of 42 KB and all works well - sending, receiving and deserializing.

Q Why doesn't it work with the larger message and how can I make it work?

Edit 0

I tried receiving a byte-array filled with a random pattern:

var bm = new BrokeredMessage(new byte[n])
  1. n = 63500 does work. (send: HeaderSize = 53, BodySize = 63572; receive: HeaderSize = 139, BodySize = 63572)
  2. n = 64000 does not work. (send: HeaderSize = 54, BodySize = 64072; receive: null)

Edit 1

@David Pfeffer It's just as simple as that:

var queueWork = QueueClient.CreateFromConnectionString(@"Endpoint=sb://***/;SharedAccessKeyName=***;SharedAccessKey=***", path, ReceiveMode.ReceiveAndDelete);
BrokeredMessage message = queueWork.Receive();

回答1:


I am unable to reproduce this. Here's my sample code:

var client = QueueClient.CreateFromConnectionString("Endpoint=sb://***.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=***", "queue", ReceiveMode.ReceiveAndDelete);
client.Send(new BrokeredMessage(new byte[100000]));
var msg = client.Receive();
// msg is happy


来源:https://stackoverflow.com/questions/27277820/azure-servicebus-client-receive-returns-null-for-messages-64-kb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!