Simulate System Faults

Not applicable

Is there any way to simulate a system fault similar to what would be thrown in the cases of

OutOfMemory, GCOverLimit or RogueTaskTerminated? If so, how would this be done?

Thanks!

Stephan P. Cossette, Developer stephan.p.cossette@accenture.com

Solved Solved
0 4 197
1 ACCEPTED SOLUTION

Former Community Member
Not applicable

Hi @Stephan.Cossette you can use an AssignMessage & RaiseFault policy to mimic system faults.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Fault-Variables">
    <DisplayName>Assign Fault Variables</DisplayName>
    <AssignVariable>
        <Name>fault.name</Name>
      	<Value>OutOfMemory</Value>
    </AssignVariable>
      <AssignVariable>
        <Name>fault.type</Name>
      	<Value>System</Value>
    </AssignVariable>
      <AssignVariable>
        <Name>fault.category</Name>
      	<Value>Memory</Value>
    </AssignVariable>
   <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="RaiseOutOfMemoryFault">
    <DisplayName>RaiseOutOfMemoryFault</DisplayName>
    <Properties/>
    <FaultResponse>
        <Set>
            <Headers/>
            <Payload contentType="text/plain"> </Payload>
            <StatusCode>500</StatusCode>
            <ReasonPhrase>Server Error</ReasonPhrase>
        </Set>
    </FaultResponse>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>

You can add these policies in that order to any flow. You would want to make the execution of the policy conditional so that it executes when specific conditions are met. For eg: you can pass a header (raise-OutOfMemory equals true) when invoking the API proxy and have a conditional flow that will execute the policy & throw the OutOfMemory fault when this header is passed:

<Flow name="some flow">
	<Description/>
     <Request>
            <Step>
                <Name>Assign-Fault-Variables</Name>
              	<Condition>request.header.raise-OutOfMemory equals true</Condition>
            </Step>
            <Step>
                <Name>RaiseOutOfMemoryFault</Name>
              	<Condition>request.header.raise-OutOfMemory equals true</Condition>
            </Step>
        </Request>

    <Response/>            
</Flow>Hope this helps.

View solution in original post

4 REPLIES 4

Former Community Member
Not applicable

Hi @Stephan.Cossette you can use an AssignMessage & RaiseFault policy to mimic system faults.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Fault-Variables">
    <DisplayName>Assign Fault Variables</DisplayName>
    <AssignVariable>
        <Name>fault.name</Name>
      	<Value>OutOfMemory</Value>
    </AssignVariable>
      <AssignVariable>
        <Name>fault.type</Name>
      	<Value>System</Value>
    </AssignVariable>
      <AssignVariable>
        <Name>fault.category</Name>
      	<Value>Memory</Value>
    </AssignVariable>
   <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="RaiseOutOfMemoryFault">
    <DisplayName>RaiseOutOfMemoryFault</DisplayName>
    <Properties/>
    <FaultResponse>
        <Set>
            <Headers/>
            <Payload contentType="text/plain"> </Payload>
            <StatusCode>500</StatusCode>
            <ReasonPhrase>Server Error</ReasonPhrase>
        </Set>
    </FaultResponse>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>

You can add these policies in that order to any flow. You would want to make the execution of the policy conditional so that it executes when specific conditions are met. For eg: you can pass a header (raise-OutOfMemory equals true) when invoking the API proxy and have a conditional flow that will execute the policy & throw the OutOfMemory fault when this header is passed:

<Flow name="some flow">
	<Description/>
     <Request>
            <Step>
                <Name>Assign-Fault-Variables</Name>
              	<Condition>request.header.raise-OutOfMemory equals true</Condition>
            </Step>
            <Step>
                <Name>RaiseOutOfMemoryFault</Name>
              	<Condition>request.header.raise-OutOfMemory equals true</Condition>
            </Step>
        </Request>

    <Response/>            
</Flow>Hope this helps.

Former Community Member
Not applicable

@Stephan.Cossette here is a sample proxy that shows you how to do this. Deploy this as an API bundle (New API Proxy, pick the API Bundle option, point to this zip file, deploy this into your org) and pass in the header raise-OutOfMemory = true when invoking the api proxy. Let me know if you have any questions.

no-target-rev1-2015-04-30.zip

Not applicable

Thanks Prithpal for your response! 😄

Thanks!

Steve

Welcome to the community @Stephan.Cossette! Look forward to many more questions from you 🙂

PS. Feel free to "Accept" answers when you think it has helped you to resolve a question at hand.