如果应用错过通知,该怎么办-SequenceNumber跳了一个或多个? [英] What to do if app misses notification - SequenceNumber jumps over by one or more?
问题描述
我现在在哪里?我已经通过office365的REST API订阅了日历通知.在创建/更新/删除该日历中的任何事件时,office365将通知发送到我在创建此订阅时分配的我的应用程序端点.订阅代码的工作原理就像一个超级按钮,通知会立即到来.
我真的想让我的代码容错,这就是问题所在:如果通知以非增量顺序出现,会发生什么?例如,如果有人首先创建事件,然后将其删除.那些通知可以相反的顺序吗? 1.移除事件,2.创建事件.我在文档中找不到此内容.
我真的对您在代码中处理SequenceNumber
的方式很感兴趣.
文档表示:
SequenceNumber-通知的顺序编号,以帮助客户端应用程序识别是否缺少通知.
好的,很高兴知道我是否错过了通知,但是您能告诉我在这种情况下该怎么做吗?这似乎在任何地方都很难解释.
-
SequenceNumber
的行为方式例如它们可以以非递增顺序出现吗? - 如果错过了
SequenceNumber
怎么办?
通过测试我发现了什么,我看到SequenceNumber
始终是递增顺序的.但是我不确定是否总是这样?
更重要的是,如果我的应用程序错过了SequenceNumber
怎么办?我的意思是,如果出现1、2、3,下一个是5或6,那我该怎么办?
我也不太确定ChangeType: Missed
是否与此有关.我对此感到非常困惑,因此不胜感激! :)
我测试过的内容永远不会跳过SequenceNumber,但是好的做法是为每个订阅建立一个通知队列,并按SequenceNumber的顺序逐个处理通知. /p>
ChangeType:Missed并不能说明太多.它几乎告诉您只有哪些订阅错过了通知.通过日历集成,我最终检查了哪个日历对应于该subscriptionId,然后运行完全同步以验证我们是否错过了办公室中的任何更改.
Where I am right now? I have subscribed to calendar notifications via office365's REST API. When any event in that calendar are created/updated/deleted office365 sends notification to my app's endpoint which I assigned when I created this subscription. Subscription code works like a charm and notifications are coming immediately.
I really want to make my code error tolerant and here comes the problem: what happens if notifications are coming in non-incremental order? For example if someone first creates event and then removes it. Can those notifications come in opposite order? 1. remove event, 2. create event. I failed to find this in documentation.
I am really interested about how you have been handling SequenceNumber
in your code.
This is what documentation says:
SequenceNumber - A number in sequence for a notification, to help the client app identify if it's missing a notification.
Okay, it's nice to know if I missed a notification, but can you tell me what to do in that case? This seems to be really poorly explained in anywhere.
- How
SequenceNumber
behaves e.g. can they come in non-incremental order? - What to do if you miss a
SequenceNumber
?
What I have figured out by testing this, I see that SequenceNumber
is always in incremental order. But I'm not sure is this always the case?
And more importantly, what to do IF my app misses SequenceNumber
? I mean if there comes 1, 2, 3 and next one is 5 or 6, what should I do then?
Also I'm not quite sure if ChangeType: Missed
has something to do with this. I'm really confused about this so any help would be appreciated! :)
What I have tested it never jumps over a SequenceNumber, but good practice is to build a notification Queue per subscription and handle notifications one by one ordered by SequenceNumber.
ChangeType: Missed doesn't tell much. Pretty much it tells you only what subscription has missed notification. With calendar integration I ended up to check which calendar corresponds that subscriptionId and then just run full sync to validate if there has any changes in office we missed or not.
这篇关于如果应用错过通知,该怎么办-SequenceNumber跳了一个或多个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!