-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support deferred messages or delayed processing #411
Comments
I see some similarity with #25 indeed. However, @tomkerkhove mentions there that the pump should orchestrate this, but I don't know how the pump could do that. The pump has no knowledge of the 'business logic' that must be executed (what must be executed first). |
I've tried implementing this by calling the This issue is related to what we want to achieve here: Azure/azure-service-bus#454 One of the workarounds that is proposed in the above issue is to 'Defer' the message and keep track of the deferred message by sending another message to the queue which contains the sequence-number of the deferred message so that it can be retrieved later. I was thinking of having something like:
Of course, this is still -imho- a workaround for the problem at hand. Ideally, MSFT solves this by adding this functionality in ServiceBus as this work-around brings a few other problems to the table:
|
Sounds like a plan! 🎉 Thx a lot for documenting/investigating this so thoroughly. Will see if I can work on something while you're gone. 👍 |
The feature is done being designed and almost picked up for development: Azure/azure-service-bus#454 (comment) |
Well, I think this is something we're going to need very soon in a project. Also, other teams might find it very useful. |
Yes, think that is a good approach. Unless of course this is very critical for other projects, otherwise I would be in favor to wait a bit for Microsoft to catch up. |
I think it is a crucial feature, something that should have been implemented by MSFT from the start imho. Another thing regarding the possible implementation. I've discussed this with @gverstraete yesterday as well, and his first idea on how to implement this, could also be an option: When 'deferring' a message, we could create a clone of the message, (with the same body and properties) and send this message to service bus with a `ScheduledEnqueuetimeUtc', and next to that we must then also make sure to 'accept' the original message so that it is no longer available in the queue. |
Ah yes, but I'm wondering what Impact this could have on the performance/scaling/cost of Service Bus as for every message, there will be two in the queue. Otherwise, this is indeed a rather elegant solution. |
Service Bus bills you per operation, not by the amount of messages. Service Bus Pricing.
That's a good point, and indeed a drawback. |
The thing is that we'll need to decide on how to continue with this:
I would be in favor to not to wait for MSFT as we don't know how soon the feature will be delivered. We can close the gap for now with an alternative approach. Once MSFT comes up with their solution, we can rework our workaround to use the 'official implementation'. What's your take @gverstraete ? |
Agree, I think cloning makes most sense |
For implementation, I would go with 'cloning' the message. That looks to be the most simple solution. Next to that, we must take into consideration that a processor not only needs to have listen permissions to the queue (or topic), but also needs to have send permission. When MSFT has finished it's implementation, we can refactor our internal workings to make use of the functionality MSFT provides. If no 'send' rights are required for MSFT's implementation, we can modify our documentation and make a note of this in our release-notes. |
Any update on this? We need this feature at NxtPort to implement a retry mechanism with custom backoff times. |
We are working on a circuit breaker, but that would not include deferred messaging. No time/budget to implement a custom solution as of yet. But we are always happy to receive PR's 😉. |
I think it is possible, though, to defer the message yourself in the message handler, add an application property with a timestamp, and filter with another message handler for certain past times. But as I've said, no room to take anything else at the moment. |
I think it is very hard to implement this in the MessageHandler itself. First of all, Arcus currently doesn't expose a It looks like MSFT is not very responsible on my requests in this issue so my plan for a workaround in Arcus would be like this:
More info on deferring in ServiceBus can be found here: https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-deferral#message-deferral-apis. The approach I mentionned here is actually more or less described in the 'sample scenarios' paragraph of that article. |
We're talking about the same thing here 😉 |
We cannot do that in the messagehandler. |
We might have processes where we receive a message from servicebus that cannot be processed yet. (For instance because we're waiting on another message coming from another party first).
In such situations, it would be good if we could defer the message or resubmit the same message.
It would be nice if we could do this in the implementation of the message-handler. I can see that the
AzureServiceBusMessageHandler
now already has functionality to Complete or Abandon messages via protected methdos. Some 'defer' or 'resubmit' logic there would be appropriate I think.I think there are 2 approaches:
Re-submitting:
I'm thinking of having the possibility of re-submitting the exact same message to Service Bus again, but with a specific / specified
ScheduledEnqueueTimeUtc
property. Docs on this here. (That would probably mean completing the initial message and then resubmitting a copy of it , with all the same properties etc... but with a specified ScheduledEnqueueTimeUtc ?(Or can this be implemented by abandoning the message and passing in the necessary 'propertiesToModify' ? [ pass in
ScheduledEnqueueTimeUtc
as propertyToModify ? )Deferring
This might be another possible approach, but I think it's more complex?
Some documentation on the defer-functionality that is provided by Azure ServiceBus can be found here.
The drawback of deferring -as I see it-, is that you need another mechanism to retrieve deferred messages again, and that you need to specify which deferred message you want to retrieve again (so you need to keep state / administration for this).
The text was updated successfully, but these errors were encountered: