Interface EPVariableService
public interface EPVariableService
Service for variable management.
-
Method Summary
Modifier and TypeMethodDescriptiongetVariableValue
(String deploymentId, String variableName) Returns the current variable value for a global variable.getVariableValue
(Set<com.espertech.esper.common.internal.util.DeploymentIdNamePair> variableNames) Returns current variable values for each of the global variable names passed in, guaranteeing consistency in the face of concurrent updates to the variables.Map<com.espertech.esper.common.internal.util.DeploymentIdNamePair,
List<ContextPartitionVariableState>> getVariableValue
(Set<com.espertech.esper.common.internal.util.DeploymentIdNamePair> variableNames, ContextPartitionSelector contextPartitionSelector) Returns the current variable values for a context-partitioned variable, per context partition.Returns current variable values for all global variables, guaranteeing consistency in the face of concurrent updates to the variables.void
setVariableValue
(String deploymentId, String variableName, Object variableValue) Sets the value of a single global variable.void
setVariableValue
(Map<com.espertech.esper.common.internal.util.DeploymentIdNamePair, Object> variableValues) Sets the value of multiple global variables in one update, applying all or none of the changes to variable values in one atomic transaction.void
setVariableValue
(Map<com.espertech.esper.common.internal.util.DeploymentIdNamePair, Object> variableValues, int agentInstanceId) Sets the value of multiple context-partitioned variables in one update, applying all or none of the changes to variable values in one atomic transaction.
-
Method Details
-
getVariableValue
Returns the current variable value for a global variable. A null value is a valid value for a variable. Not for use with context-partitioned variables.- Parameters:
deploymentId
- deployment idvariableName
- is the name of the variable to return the value for- Returns:
- current variable value
- Throws:
VariableNotFoundException
- if a variable by that name has not been declared
-
getVariableValue
Map<com.espertech.esper.common.internal.util.DeploymentIdNamePair,List<ContextPartitionVariableState>> getVariableValue(Set<com.espertech.esper.common.internal.util.DeploymentIdNamePair> variableNames, ContextPartitionSelector contextPartitionSelector) throws VariableNotFoundException Returns the current variable values for a context-partitioned variable, per context partition. A null value is a valid value for a variable. Only for use with context-partitioned variables. Variable names provided must all be associated to the same context partition.- Parameters:
variableNames
- are the names of the variables to return the value forcontextPartitionSelector
- selector for the context partition to return the value for- Returns:
- current variable value
- Throws:
VariableNotFoundException
- if a variable by that name has not been declared
-
getVariableValue
Map<com.espertech.esper.common.internal.util.DeploymentIdNamePair,Object> getVariableValue(Set<com.espertech.esper.common.internal.util.DeploymentIdNamePair> variableNames) throws VariableNotFoundException Returns current variable values for each of the global variable names passed in, guaranteeing consistency in the face of concurrent updates to the variables. Not for use with context-partitioned variables.- Parameters:
variableNames
- is a set of variable names for which to return values- Returns:
- map of variable name and variable value
- Throws:
VariableNotFoundException
- if any of the variable names has not been declared
-
getVariableValueAll
Returns current variable values for all global variables, guaranteeing consistency in the face of concurrent updates to the variables. Not for use with context-partitioned variables.- Returns:
- map of variable name and variable value
-
setVariableValue
void setVariableValue(String deploymentId, String variableName, Object variableValue) throws VariableValueException, VariableNotFoundException Sets the value of a single global variable.Note that the thread setting the variable value queues the changes, i.e. it does not itself re-evaluate such new variable value for any given statement. The timer thread performs this work.
Not for use with context-partitioned variables.- Parameters:
deploymentId
- deployment idvariableName
- is the name of the variable to change the value ofvariableValue
- is the new value of the variable, with null an allowed value- Throws:
VariableValueException
- if the value does not match variable type or cannot be safely coerced to the variable typeVariableNotFoundException
- if the variable name has not been declared
-
setVariableValue
void setVariableValue(Map<com.espertech.esper.common.internal.util.DeploymentIdNamePair, Object> variableValues) throws VariableValueException, VariableNotFoundExceptionSets the value of multiple global variables in one update, applying all or none of the changes to variable values in one atomic transaction.Note that the thread setting the variable value queues the changes, i.e. it does not itself re-evaluate such new variable value for any given statement. The timer thread performs this work.
Not for use with context-partitioned variables.- Parameters:
variableValues
- is the map of variable name and variable value, with null an allowed value- Throws:
VariableValueException
- if any value does not match variable type or cannot be safely coerced to the variable typeVariableNotFoundException
- if any of the variable names has not been declared
-
setVariableValue
void setVariableValue(Map<com.espertech.esper.common.internal.util.DeploymentIdNamePair, Object> variableValues, int agentInstanceId) throws VariableValueException, VariableNotFoundExceptionSets the value of multiple context-partitioned variables in one update, applying all or none of the changes to variable values in one atomic transaction.Note that the thread setting the variable value queues the changes, i.e. it does not itself re-evaluate such new variable value for any given statement. The timer thread performs this work.
Only for use with context-partitioned variables.- Parameters:
variableValues
- is the map of variable name and variable value, with null an allowed valueagentInstanceId
- the id of the context partition- Throws:
VariableValueException
- if any value does not match variable type or cannot be safely coerced to the variable typeVariableNotFoundException
- if any of the variable names has not been declared
-