-
-
Notifications
You must be signed in to change notification settings - Fork 15
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 Duplicate Detection #39
Conversation
Thanks for this pr. I think this makes more sense just storing the message id in the IMessage.Properties, but it sounds like from that article it needs to be stored on the message itself. Perhaps it would make sense to store a this as a first class property on IMessage (as well as correlation id?) @ejsmith? Also please feel free to join our discord to chat with us in real time. |
Thanks @niemyjski . From the article:
This is pretty crucial. It means it's up to the code sending the message (i.e external to this library) to determine what the identifier should be (and thus what is a duplicate). There are probably a few ways to do this but basically the identifier needs to be passed in the parameters to It looks to me like the Also I wasn't sure how specific to Azure Service Bus this was so didn't want it to creep into the base library.
I think time difference might make that impractical but I'll take a look :) |
Could this be part of the message options? I think I'm good with it being an interface we check for as well. |
Apologies @ejsmith. I've been distracted for the last few days.
What message options do you mean? |
I have discovered another issue that's kind of related to duplicate detection in the queue implementation as well so I've included the fix for that. Basically when a message has a specified identifier then you can't use that as the lock token in the queue anymore. I wasn't sure of the consequences of altering the id on the Hope that's ok to include in this PR. It all seems related to duplicate detection to me. |
I'm not 100% sure on the context of this, he will be back shortly from vacation. Nice find on the lock, is this property guaranteed to be in properties or is it a setting you must set when creating the queue. Any docs you could link to would go a long ways for documentation. I think this is good to merge, my only change would be to possibly add MessageId/CorrelationId to the IMessage interface. We can discus this in discord too. |
Sorry guys. Have had zero time to put into this in recent weeks. |
Regarding the lock token, I think since the receive mode is hard coded and therefore there is definitely a lock token on the message then this should all be ok. If the library decides to support more receive modes in the future then you might have to confirm more about whether there is a lock token always available. |
Sorry for the delayed response. I was referring to this: That is allowing options to be set for a queue entry. I like the feature you are adding, my only concern is whether it makes sense to have the new |
Ok I see what you're referring to. How do you think the subscriber might get the |
I apologise as I've had many other things to occupy my time in the last month or two but is there anything I can do to get this merged? |
@ejsmith I kinda feel we should just add this as a first class property to our messages |
@niemyjski Do you mean force every object that is being sent as a message to have an My only thought is whether that has any relevance outside the Azure Service Bus implementation (and even then only one with duplicate detection turned on)? I guess you could potentially use a unique id on a message for other reasons? |
@niemyjski and @ejsmith Does anything need to happen to merge this? |
I think this was the only thing missing to being merged. Following up to your question, from reading this over breifly I think this would act just like the CorrelationId today (see usages). |
@niemyjski Ok. My only thought is that if subscriber ever needs to know the unique id of a message (e.g. to republish) then this will have to change a little again as the information will be lost. What you're suggesting works fine for my scenario though so I guess you can deal with that when you need to. Anyway, to get this to work with the |
@jcono Really sorry how long this has taken. All of the relevant PRs have been merged and the |
If the |
All done @ejsmith. Sorry for taking a few days to get to it.
Yeah I think what I was thinking of wasn't on queues but message buses. With a queue you get the I might have missed something thought and like I said not a deal breaker for me at the moment, but might possibly be at some point. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Azure Service Bus supports a duplicate message detection mechanism (https://docs.microsoft.com/en-us/azure/service-bus-messaging/duplicate-detection).
To allow this the
MessageId
needs to be able to be set on theMicrosoft.Azure.ServiceBus.Message
to a unique value. This is the simplest way I could think to get this done.Basically a message can optionally implement the
IUniqueMessage
interface which sets theMessageId
appropriately. The service bus then can detect the duplicates.