Sunday, January 5, 2014

Running ADF in High availability

Some of the things you should consider when developing ADF application running in HA environment is changes to pageFlowScope or ViewScope during a request. Making ADF aware of the changes you made to a ViewScope or pageFlowScope params is essential to replicate the changes across cluster.

To accomplish this:
1- Set the adf-scope-ha-support parameter inside adf-config.xml config file to true, this will make sure that changes will automatically replicated within a cluster.
 < adf-controller-config xmlns="">
 < adf-scope-ha-support>true</adf-scope-ha-support> </adf-controller-config>

2-  marking the scope is Dirty by adding additional code after scope changes:
    ControllerContext ctx = ControllerContext.getInstance();

note if you are making a change by reference without putting (replacing) param value in the Map you must call markScopeDirty.


Map<String, Object> viewScope = AdfFacesContext.getCurrentInstance().getViewScope();
MyObject obj = (MyObject)viewScope.get("myObjectName");

Putting value again in the map will replicate the change across cluster without calling markScopeDirty method.