-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[FEATURE REQ] Support for safe batching with MessageSender #8440
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl |
@brolaugh, thanks for creating this issue. Our engineering team is investigating into different approaches to make your coding simpler. |
@axisc since @SeanFeldman had a WIP PR in the old repo, would it be possible to resurrect that code to get this feature request moving forward? It's really unfortunate that there's no way to do safe batching with the SDK. Thanks! |
The old repository was moved into this mono-repo. New feature development is on hold, that's why I don't try to continue with the PR. Sorry, @ericsampson. |
@SeanFeldman but given that this feature request is due on 17th of January which is rather soon, it wouldn't been unreasonable for them to continue on that path you started in order to reduce workload. Right? |
@brolaugh I'm not a Microsoft employee and don't know what's the milestone planning is. Perhaps it's still planned and worked on internally? No idea, sorry. @AlexGhiondea would you be able to help with a clarification? Thank you. |
@axisc The milestone that this issue has been attached to is as of now over due by 12 days so I would have expected this feature to be implemented by now. Maybe you have structured your milestones in some other ways. Please clarify what the ETA of this feature is or how your task management is structured. |
Okay I'll wait for a response from @jfggdl then :) |
Hi guys, |
@SeanFeldman was the one working on it and he said the following earlier in this thread.
|
Moving this to the backlog milestone, as the associated sprint has passed. @axisc: I removed the outdated assignment. Would you be so kind as to help route to the appropriate individual? |
Is there any chance of having this feature request implemented? I've seen various PRs and issues raised related to this since early 2017 but it seems like any progress may have come to a standstill. @brolaugh did you find a viable work-around in the mean time? Would you mind sharing if so? Thanks! |
@ColeSiegelTR I simply sent all messages one by one like described in my original post. |
Have you considered using For example: // add the messages that we plan to send to a local queue
Queue<ServiceBusMessage> messages = new Queue<ServiceBusMessage>();
messages.Enqueue(new ServiceBusMessage("First message"));
messages.Enqueue(new ServiceBusMessage("Second message"));
messages.Enqueue(new ServiceBusMessage("Third message"));
// create a message batch that we can send
// total number of messages to be sent to the Service Bus queue
int messageCount = messages.Count;
// while all messages are not sent to the Service Bus queue
while (messages.Count > 0)
{
// start a new batch
using ServiceBusMessageBatch messageBatch = await sender.CreateMessageBatchAsync();
// add the first message to the batch
if (messageBatch.TryAddMessage(messages.Peek()))
{
// dequeue the message from the .NET queue once the message is added to the batch
messages.Dequeue();
}
else
{
// if the first message can't fit, then it is too large for the batch
throw new Exception($"Message {messageCount - messages.Count} is too large and cannot be sent.");
}
// add as many messages as possible to the current batch
while (messages.Count > 0 && messageBatch.TryAddMessage(messages.Peek()))
{
// dequeue the message from the .NET queue as it has been added to the batch
messages.Dequeue();
}
// now, send the batch
await sender.SendMessagesAsync(messageBatch);
// if there are any remaining messages in the .NET queue, the while loop repeats
} More information on //cc: @JoshLove-msft |
Hello all, The newer package Closing this issue as there are no plans to add the feature discussed here to the older Thanks for your patience! |
Is your feature request related to a problem? Please describe.
As described in Azure/azure-service-bus-dotnet#539
Describe the solution you'd like
I'd like to write the following code without worrying about an
MessageSizeExceededException
But since there already a
SendAsync
method that takesIList<Message>
one could name itSendChunkedAsync()
,SendBatchAsync()
or something else that doesn't conflict.I'm thinking that this method would use the current
SendAsync(IList<Message>)
method to send it's chunks ofMessage
s in order to pack them into as few AMPQ messages as possible.Describe alternatives you've considered
I've tried to chunk the messages my self as described in this article but given that the
Size
property of theMessage
class only accounts for body size.This is the my current solution from my understanding sends all the messages individually. Or at least it appears so on the when looking at the code.
The text was updated successfully, but these errors were encountered: