-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting error from service bus on sending message of size greater then 1 MB for premium tier. #22962
Comments
Thanks for reaching out @sabharwal-garv and for your investigations. |
Hey @sabharwal-garv, I have investigated the issue, and am acknowledging the problem. Your Suggested FixComing to the fix that you are considering... using Promise.all and resolving many promises at once in the SDK will not give a nice/simple/intuitive experience for the customers when a few of the send calls fail. WorkaroundI would instead recommend you a workaround on similar lines. // WORKAROUND
//... messages is an array with messages of size > 1MB
const sendMessagesPromises = messages.map((message) => { return sender.sendMessages(message); });
await Promise.all(sendMessagesPromises); I hope this workaround helps your case. Future StepsMeanwhile, I will contact the service team on the
I really appreciate your efforts in digging around investigating the issue and suggesting a fix. Will keep this issue open and keep you posted on what the service team recommends. But the workaround I suggested would help you get unblocked asap. |
Hi @HarshaNalluru , Thank you for your response, The workaround suggested by you will not fix our issue when single message size is of greater then 1 MB, till the message size limit for batch is increased or else case inside SDK code on the Issue with WorkaroundPlease refer to the code: same code attached in the issue description to reproduce the issue.
as you can see in the code we are trying to send single message of size greater then 1 MB not array of messages still we are getting error, it is due to the else case of SDK code for sendMessages API function azure-sdk-for-js/sdk/servicebus/service-bus/src/sender.ts Lines 208 to 223 in 9819e80
Request you to please suggest a different workaround if any as we are still blocked. |
Hey @sabharwal-garv, Thanks for the message. After talking to others in the feature crew for service-bus SDKs, we decided to go with "allow sending a single message without creating a batch for it", PR created for it #23014. Feel free to provide feedback. While we have this solution, we are also going to ask the service team for new properties on the link to manage batching of messages better in the sendMessages method. I'll post more on this if there is progress on these discussions. But, for now, I believe this #23014 should work for you. |
Hi @HarshaNalluru , I think this solution will work and will resolve our issue and I have gone through the code, and added one suggestions on the PR if you think that will not be helpful please mark that as resolve |
Yes, @sabharwal-garv. I'll be updating the function description. |
@sabharwal-garv, the fix has been published with the |
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
import { AzureFunction, Context, HttpRequest } from '@azure/functions'; import { ServiceBusMessage, ServiceBusClient } from '@azure/service-bus'; import * as config from './function.json'; const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> { const serviceBusMessage: ServiceBusMessage = { body: req.body } as ServiceBusMessage try { const serviceBusClient = new ServiceBusClient("set this value accordingly"); const sender = serviceBusClient.createSender("set this value accordingly"); await sender.sendMessages(serviceBusMessage); } catch (error) { context.log.error(
error SendMessage${error}); throw error; } }; export default httpTrigger;
Expected behavior
sender.sendMessages should not throw error.
Error Body
InvalidOperationError: The link 'G4S2:3993911:hybris.syndication-product.cds-sbt-2ce21e98-e39b-0b4b-a421-48f12923638f' is force detached by the broker because publisher(link9441) received a batch message with no data in it. Detach origin: Publisher.
Additional context
as per the document large-messages-support Batching is not supported for Large Messages and as per the sendMessage code https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicebus/service-bus/src/sender.ts#L193-L223, inside else case we are creating batch from message due to which we are getting this error, on my local machine I replaced it with following code :
it worked, request you to please look into this.
Dummy data for issue verification
The text was updated successfully, but these errors were encountered: