How to Implement a Fall-Back Feature
How will you handle
the situation when you have a big release which consists of multiple modules being integrated in one go for Production Release of your appilcation?
Taking into consideration there might
be issue with any of one of ingredient module’s code, will make entire application do go down - and hence the business will be down. A simple flaw in one file
may make your entire application to get down.
= Here is the approach:
Design a Table in
database which will hold two columns ModuleNames
and flag.
ModuleName will store the name of multiple modules which are
being released in current release.
When the application starts it reads the ModuleName &
Flag in memory. We may store the value
from the following table in a static HashMap as
< String, boolean > .
Module_id (PK)
|
Module_Name
|
isEnabled (Flag)
|
Dependent_Module_id(FK)
|
1
|
ProtectAlert
|
1
|
2
|
2
|
Coexistance
|
1
|
-
|
3
|
InvestAlert
|
0
|
-
|
Introduce an If- block just before the line number where you
have made code change for a CR.
if (!isProtechAlertsNotifyToCAEnabled())
{
asyncNewDeviceLoginAndAccntLock(userDetails, resultMap);//CR specific
method name
} else {
if (log.isInfoEnabled()) {
log.info("isAlertNotifyFallback
is Enabled here.\n");
}
}
Implementation of this method:
public static boolean
isProtechAlertsNotifyToCAEnabled() {
boolean
isProtechAlertsNotify = false;
Map allFallbackParams = ConversionUtils.getContentFromCMCache(
walletFUT_CONTENT_TYPE);
if (null !=
allFallbackParams) {
if (null !=
allFallbackParams.get("isAlertNotifyFallback")) {
boolean isFlagOn =
allFallbackParams
.get("isAlertNotifyFallback");
if (isFlagOn) {
isAlertsNotify =
true;
}
}
}
}
Comments