Hi Devs, To persist Subscription information given by a user at the time of cartridge a subscription, we can use a Registry. Subscription information are not dynamic, they do not regularly change. However, these data might be required at runtime for various operations. By using a registry, we can store the subscription details as a Resource, and access it when required.
However, one pitfall this approach can have is accessing registry being relatively expensive. So, if we access the Registry frequently in runtime, it would lead to a performance degradation. Therefore, I thought to use an in-memory cache so that we don't have to access the registry each and every time we need to access some information. The idea is to populate the cache when required, and in runtime avoid accessing the registry, and use the cached data. I have included a very high level diagram of the proposed solution. Please share your feedback. [image: Inline image 1] The scenarios would be: 1. We populate the cache when required (startup time / tenant loading time), with any existing Subscription details 2. Subsequent retrievals are catered to with the cached information 3 & 4. Any changes (very infrequent) or new Subscriptions would be updated in the cache first, and then the Registry. Ideally, updating the registry should be a non-blocking call. -- Thanks and Regards, Isuru H. Software Engineer, WSO2 Inc. +94 716 358 048* <http://wso2.com/>*
<<registry_based_subscription_persistence.png>>
