Package org.apache.synapse.endpoints
Class EndpointContext
- java.lang.Object
-
- org.apache.synapse.endpoints.EndpointContext
-
public class EndpointContext extends Object
This class is one of the key classes of the Endpoint management in Synapse. It maintains the runtime state of an endpoint for local and clustered endpoint configurations.
-
-
Field Summary
Fields Modifier and Type Field Description static intST_ACTIVEAnd active endpoint known to be functioning properlystatic intST_OFFAn endpoint manually switched off into maintenance - it will never change state automaticallystatic intST_SUSPENDEDAn endpoint put into the suspended state by the system.static intST_TIMEOUTAn endpoint which timed out - but now maybe ready to retry depending on the current time
-
Constructor Summary
Constructors Constructor Description EndpointContext(String endpointName, EndpointDefinition endpointDefinition, boolean clustered, org.apache.axis2.context.ConfigurationContext cfgCtx, EndpointView metricsBean)Create an EndpointContext to hold runtime state of an Endpoint
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisMaxRetryLimitReached(boolean isRecursiveEndpoint)Check whether the endpoint has exceed the maximum retry limit on failoverbooleanisState(int s)voidonFailoverRetryLimit(boolean isRecursiveEndpoint)Endpoint has exceeded the maximum retry attempts on failovervoidonFault()Endpoint failed processing a messagevoidonSuccess()Endpoint has processed a message successfullyvoidonTimeout()Endpoint timeout processing a messagebooleanreadyToSend()Checks if the endpoint is in the state ST_ACTIVE.voidswitchOff()Manually turn off this endpoint (e.g.voidswitchOn()Activate this endpoint manually (i.e.StringtoString()
-
-
-
Field Detail
-
ST_ACTIVE
public static final int ST_ACTIVE
And active endpoint known to be functioning properly- See Also:
- Constant Field Values
-
ST_TIMEOUT
public static final int ST_TIMEOUT
An endpoint which timed out - but now maybe ready to retry depending on the current time- See Also:
- Constant Field Values
-
ST_SUSPENDED
public static final int ST_SUSPENDED
An endpoint put into the suspended state by the system. Will retry after an applicable delay- See Also:
- Constant Field Values
-
ST_OFF
public static final int ST_OFF
An endpoint manually switched off into maintenance - it will never change state automatically- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EndpointContext
public EndpointContext(String endpointName, EndpointDefinition endpointDefinition, boolean clustered, org.apache.axis2.context.ConfigurationContext cfgCtx, EndpointView metricsBean)
Create an EndpointContext to hold runtime state of an Endpoint- Parameters:
endpointName- the name of the endpoint (mainly for logging)endpointDefinition- the definition of the endpoint (e.g. retry time, suspend duration..)clustered- is the environment clustered?cfgCtx- the Axis2 configurationContext for clustering
-
-
Method Detail
-
onSuccess
public void onSuccess()
Endpoint has processed a message successfully
-
onFault
public void onFault()
Endpoint failed processing a message
-
onTimeout
public void onTimeout()
Endpoint timeout processing a message
-
readyToSend
public boolean readyToSend()
Checks if the endpoint is in the state ST_ACTIVE. In a clustered environment, the non availability of a clustered STATE_KEY implies that this endpoint is active- Returns:
- Returns true if the endpoint should be considered as active
-
switchOff
public void switchOff()
Manually turn off this endpoint (e.g. for maintenence)
-
switchOn
public void switchOn()
Activate this endpoint manually (i.e. from an automatic suspend or manual switch off)
-
isState
public boolean isState(int s)
-
isMaxRetryLimitReached
public boolean isMaxRetryLimitReached(boolean isRecursiveEndpoint)
Check whether the endpoint has exceed the maximum retry limit on failover
-
onFailoverRetryLimit
public void onFailoverRetryLimit(boolean isRecursiveEndpoint)
Endpoint has exceeded the maximum retry attempts on failover
-
-