Significance of AlwaysEnforce in DefaultFaultHandling

Not applicable

I am trying to understand the significance of AlwaysEnforce in DefaultFaultRule.

When Some FaultRules does not invoke any RaiseFault,the DefaultFaultRule is executed if AlwaysEnforce=true.Instead we can have the same policies present in DefaultFaultRule, under the other FaultRules itself.

I am not clear of its importance because if any fault happens in the other FaultRule,then DefaultFaultRule not going to execute evenif AlwaysEnforce=true.

It would have been better logic,if it is like even if other FaultRules raises Fault or not,DefaultFaultRule always executes if AlwaysEnforce=true.This kind of logic helps if we keep Messagelogging kind of policies in DefaultFaultRule which is kind of Postflow for error path and hence messages always logged even if Fault raises in other FaultRule.

Need clarifications please on why its been built this way....

If this had been implemented this way,then it could easily solve my other usecase cited in here

0 2 83
2 REPLIES 2

ok, let me try with a java based try-finally pseudo code - assuming you are familiar with this

try{
	//Preflow 
	//Flows
	//PostFlow
}finally{
	boolen faultexecuted=false
	//FaultRule1
	try{}	
	finally{faultexecuted=true;}


	//Fault Rule2
	try{}
	finally{faultexecuted=true}


	if(! (alwaysenforce ^ faultexecuted) ){
		//Default Fault Rule
		  try{}	
		  finally{}
	}
}

so given this, the only way you can guarantee that Default rule will execute is,

1) Your FaultRules do not result in error or throw exceptions - just handle it within the FaultRules

2) set AlwaysEnforce = true

Ok..This explains how it works internally..Thanks for that.

I have got solution on how to always execute a policy even in error path as given in the answer here