0
votes

I'm using MassTransit to send and receive microservice commands. It sends and receives fine when I run it locally (connecting to the Azure Service Bus instance remotely). E.g. I send a command from a local console application to the remote ServiceBus queue (which I can see in Service Bus Explorer 3.0.4) and then my local TopShelf service receives and handles the command. But when I deploy my service it fails with the following error:

Microsoft.ServiceBus.Messaging.MessageSizeExceededException: The received message (delivery-id:0, size:1904586 bytes) exceeds the limit (262144 bytes) currently allowed on the link.

I'm only sending one message, and the message is rather big, but certainly not 1.8MB as mentioned in the error! It's only a little bigger than 100KB.

I found this post regarding batch partitioning of messages, but that seems to me only relevant if you want to split multiple messages into smaller groups of messages. I'm only sending one message. Also, I can't find any documentation in MassTransit on how to actually do that. I tried setting IServiceBusHostConfigurator like this: cfg.BatchFlushInterval = TimeSpan.FromSeconds(0.05);

  1. Can someone explain why it thinks my messages are so much bigger?
  2. Am I able to split the single message into smaller partitions? Or is there a different solution?
  3. Should I disable partitioning altogether? If so, how?
1
@stuartd Thanks, I posted the same question on that forum. Not sure how Google Groups work - it might need vetting or something - but I can't see my own question anywhere. I posted it again just to make sure, but after clicking "POST" it just disappears and redirects to the homepage.hofnarwillie

1 Answers

0
votes

Service Bus has a limit of 256k for the message, and that includes the serialization envelope surrounding the message body itself. If you're seeing a message size of 1.9MB in the error, you're clearly pushing a pretty huge message.

Look more closely at your message size, and if you have things like attachments or binary data in the message, consider using the MessageData<> feature to send the binary payload out of band.