-
Notifications
You must be signed in to change notification settings - Fork 1k
[Server] Restore durable subscriptions on Server Restart #3025
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
Conversation
* [Server] Durable Subscriptions (OPCFoundation#2683) * Implement a system test for DurableSubscriptions (OPCFoundation#2839) * Client Side Co-authored-by: ALTERNATE-DEV\Archie <archie@dreamsandadventures.ca>
Use NodeIdDictionary where possible
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3025 +/- ##
==========================================
+ Coverage 56.70% 56.83% +0.13%
==========================================
Files 356 357 +1
Lines 68110 68862 +752
Branches 13950 14133 +183
==========================================
+ Hits 38619 39138 +519
- Misses 25339 25528 +189
- Partials 4152 4196 +44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mrsuciu
left a comment
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.
Overall looks good. See the comments.
Proposed changes
This PR Enables the Server to persist existing durable subscriptions (incl message queue) on a server shutdown (incl. MonitoredItems & event / datatchange queues). And restore them after a server restart.
The persisting is done by extending
Subscription&MonitoredItemwith a method that converts the internal state of the object into a format that can be json serialized.For this Subscription has a new Method
public IStoredSubscription ToStorableSubscription().The IMonitoredItem interface is extended with a new Method
IStoredMonitoredItem ToStorableMonitoredItem().Both Subscription & Monitoreditem have a new constructor accepting an
IStoredSubscription/IStoredMonitoredItem.The
MasterNodeManagerhas a new MethodAlso
INodeManageris extended with a new MethodThose methods are only called (& need to be implemented) if durable subscriptions will be supported by the server.
They will be called by the
SubscriptionManageron Startup if subscriptions to restore a found.The
SubscriptionManagerhas access to an InterfaceISubscriptionStorethat is registered globally in the server.The Interface has methods for Storing & Restoring Subscriptions & providing access to durable queues after a restart.
In the reference server the
SubscriptionStoreimpementation communicates with theIMonitoredItemQueueManagerto store & restore durable queues.On Shutdown the
SubscriptionManagerwill initate the storing process if anISubscriptionStoreis registered & durable subscriptions are enabled & present on the server.In the reference server the serializable objects are written into a file in the current exectuting directory.
Types of changes
Checklist
Further comments
Open Issues: