public interface IScenarioService
extends java.lang.AutoCloseable
Note that Queries and DataViews are both represented as "scenarios" in this API.
Since this is an asynchronous service, there is a standard pattern that clients should normally follow to ensure they become aware of all Scenarios in the correlator.
If a listener is passed to the factory method, then that listener will be notified of all scenarios as they are discovered, and the client will not "miss" any scenarios. This is the recommended usage pattern.
If a listener is not passed to the factory method, then the following pattern must always be used:
ScenarioServiceFactory
getScenarios()
, getScenarioIds()
or
getScenarioNames()
to discover any scenarios that the service
discovered before the client listener was added.
When a client listener receives a PropertyChangeEvent from this interface,
the following describes the type of the [old/new] value that is passed with
the event:
Property Name | Property Value |
PROPERTY_SCENARIO_ADDED | IScenarioDefinition |
PROPERTY_SCENARIO_REMOVED | IScenarioDefinition |
PROPERTY_SCENARIO_SERVICE_UNLOADED | N/A (always null) |
PROPERTY_SCENARIO_DISCOVERY_STATUS | DiscoveryStatusEnum |
The Scenario Service API is thread-safe. Note that unlike other parts of the Apama API, Scenario Service listener callbacks may be invoked while locks internal to the Scenario Service are held. For this reason it is not safe to call Scenario Service methods while holding any application-defined lock that might also be acquired within a Scenario Service property change listener, as this may result in deadlock.
ScenarioServiceConfig
,
ScenarioServiceFactory
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_ACKDATA_TIMEOUT
Configuration property name specifying the the timeout between receiving
an Acknowledge for an operation (Create, Edit, Delete) and seeing the
response (Created, Edited, Delted) on the Data channel.
|
static java.lang.String |
CONFIG_AUTO_INSTANCE_DISCOVERY
Configuration property name specifying whether to automatically
initiate discovery of all scenario instances upon creating a
scenario service.
|
static java.lang.String |
CONFIG_DISCONNECT_IF_SLOW
Configuration property name specifying whether to connect to the data source
signalling that we may be disconnected if we do not keep up with events.
|
static java.lang.String |
CONFIG_FILTER_USER
Configuration property name specifying whether to only list to updates
for the specified user
If present, the scenario(s) listened for must have the ConfigureUpdates
property sendRawUser or sendThrottledUser set to true.
|
static java.lang.String |
CONFIG_RECONNECT_PERIOD
Configuration property name specifying how long to wait (in milliseconds, at a minimum)
between reconnects.
|
static java.lang.String |
CONFIG_SCENARIO_EXCLUSION_FILTER
Configuration property name for specifying a Set of ScenarioID's (Strings)
that the client wishes to exclude.
|
static java.lang.String |
CONFIG_SCENARIO_INCLUSION_FILTER
Configuration property name for specifying a Set of ScenarioID's (Strings) in
which the client is interested.
|
static java.lang.String |
CONFIG_STRONG_DATA_INBOUND_EVENT_QUEUE
Configuration property name for specifying if the EventServiceChannels created
for listening to ScenarioInstance updates (the 'Data' channel)
should use strong or soft references to events in the inbound queue.
|
static java.lang.String |
CONFIG_USE_RAW_DATA_CHANNEL
Configuration property name for specifying if the EventServiceChannels created
for listening to ScenarioInstance updates (the 'Data' channel)
should be subscribed to the normal Data channel (possibly throttled),
or the Raw Data channel (always unthrottled).
|
static long |
DEFAULT_ACKDATA_TIMEOUT
Default value for the configuration property that specifies the timeout
for waiting for an operation response after the acknowledge (60000ms).
|
static boolean |
DEFAULT_AUTO_INSTANCE_DISCOVERY
Default value for automatic instance discovery (true)
|
static boolean |
DEFAULT_DISCONNECT_IF_SLOW
Default value for the boolean flag specifying if we should be disconnected if
slow (false)
|
static long |
DEFAULT_RECONNECT_PERIOD
Default value for the reconnect period (0.0, meaning no time between reconnects)
|
static java.util.Set<java.lang.String> |
DEFAULT_SCENARIO_EXCLUSION_FILTER
Default value for the configuration property that specifies the optional
scenario exclusion filter set (null).
|
static java.util.Set<java.lang.String> |
DEFAULT_SCENARIO_INCLUSION_FILTER
Default value for the configuration property that specifies the optional
scenario inclusion filter set (null).
|
static boolean |
DEFAULT_STRONG_DATA_INBOUND_EVENT_QUEUE
Default value for the boolean flag specifying if the inbound event queues for 'Data'
channels will use strong references (true).
|
static boolean |
DEFAULT_USE_RAW_DATA_CHANNEL
Default value for the boolean flag specifying if the 'Data' channel to subscribe
to for a scenario will be the normal (possibly throttled) channel, or the
'Raw' (always unthrottled) channel (false).
|
static java.lang.String |
PROP_DEFAULT_ACKDATA_TIMEOUT
System property (in millisecond) to set the default AckData Timeout.
|
static java.lang.String |
PROP_OVERRIDE_ACKDATA_TIMEOUT
System property (in millisecond) to override AckData Timeout.
|
static java.lang.String |
PROPERTY_SCENARIO_ADDED
Property name for events fired that signal a new ScenarioDefinition has been added.
|
static java.lang.String |
PROPERTY_SCENARIO_DISCOVERY_STATUS
Property name for events fired that signal the status of the internal
mechanism for discovering scenario definitions in the Correlator.
|
static java.lang.String |
PROPERTY_SCENARIO_REMOVED
Property name for events fired that signal an existing ScenarioDefinition has been removed.
|
static java.lang.String |
PROPERTY_SCENARIO_SERVICE_UNLOADED
Property name for events fired that signal the ScenarioService has been unloaded.
|
static java.lang.String |
SYSPROP_FILTER_USER
system property specifying whether to only list to updates
for the specified user
If present, the scenario(s) listened for must have the ConfigureUpdates
property sendRawUser or sendThrottledUser set to true.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener that will be notified of changes to any
bound property of this object.
|
void |
addListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener that will be notified of changes to a
specific named bound property of this object.
|
void |
close()
Dispose this service and clean up resources.
|
void |
destroy()
Deprecated.
Replaced by
close() as of Apama version 9.10 |
void |
dispose()
Deprecated.
Replaced by
close() as of Apama version 9.10 |
java.util.Map<java.lang.String,java.lang.Object> |
getConfig()
Get the configuration properties that define the requested operating semantics of this instance of the service.
|
DiscoveryStatusEnum |
getDiscoveryStatus()
Get the status of the internal scenario discovery process.
|
IEventService |
getEventService()
Get the underlying EventService that is being used by this ScenarioService.
|
IScenarioDefinition |
getScenarioById(java.lang.String scenarioId)
Get a ScenarioDefinition for a specific scenario, using the ScenarioId as the lookup key.
|
IScenarioDefinition |
getScenarioByName(java.lang.String scenarioDisplayName)
Get a ScenarioDefinition for a specific scenario, using the Display Name as the lookup key.
|
java.util.Set<java.lang.String> |
getScenarioIds()
Get the IDs of all known scenarios (not instances) in the correlator.
|
java.util.Set<java.lang.String> |
getScenarioNames()
Get the Display Names of all known scenarios (not instances) in the correlator.
|
java.util.List<IScenarioDefinition> |
getScenarios()
Get the ScenarioDefinitions of all known scenarios in the correlator.
|
boolean |
isDestroyed()
Determine if this service is disposed.
|
void |
removeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener that was to be notified of changes to any
bound property of this object.
|
void |
removeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener that was to be notified of changes to a
specific named bound property of this object.
|
static final boolean DEFAULT_STRONG_DATA_INBOUND_EVENT_QUEUE
static final java.lang.String CONFIG_STRONG_DATA_INBOUND_EVENT_QUEUE
IEventServiceChannel.CONFIG_INBOUND_EVENT_QUEUE_SOFT_REFERENCE_PREFIXES
.static final boolean DEFAULT_USE_RAW_DATA_CHANNEL
static final java.lang.String CONFIG_USE_RAW_DATA_CHANNEL
static final java.util.Set<java.lang.String> DEFAULT_SCENARIO_INCLUSION_FILTER
static final java.lang.String CONFIG_SCENARIO_INCLUSION_FILTER
Note: If this property is non-null then the exclusion filter (CONFIG_SCENARIO_EXCLUSION_FILTER) will be entirely ignored.
static final java.util.Set<java.lang.String> DEFAULT_SCENARIO_EXCLUSION_FILTER
static final java.lang.String CONFIG_SCENARIO_EXCLUSION_FILTER
Note: If the CONFIG_SCENARIO_INCLUSION_FILTER is non-null then this exclusion filter will be entirely ignored.
static final long DEFAULT_ACKDATA_TIMEOUT
static final java.lang.String PROP_DEFAULT_ACKDATA_TIMEOUT
static final java.lang.String PROP_OVERRIDE_ACKDATA_TIMEOUT
static final java.lang.String CONFIG_ACKDATA_TIMEOUT
DEFAULT_ACKDATA_TIMEOUT
,
Constant Field Valuesstatic final boolean DEFAULT_DISCONNECT_IF_SLOW
static final java.lang.String CONFIG_DISCONNECT_IF_SLOW
static final long DEFAULT_RECONNECT_PERIOD
static final java.lang.String CONFIG_RECONNECT_PERIOD
static final java.lang.String CONFIG_FILTER_USER
static final java.lang.String SYSPROP_FILTER_USER
static final java.lang.String CONFIG_AUTO_INSTANCE_DISCOVERY
static final boolean DEFAULT_AUTO_INSTANCE_DISCOVERY
static final java.lang.String PROPERTY_SCENARIO_ADDED
static final java.lang.String PROPERTY_SCENARIO_REMOVED
static final java.lang.String PROPERTY_SCENARIO_SERVICE_UNLOADED
static final java.lang.String PROPERTY_SCENARIO_DISCOVERY_STATUS
DiscoveryStatusEnum
,
Constant Field Valuesjava.util.Map<java.lang.String,java.lang.Object> getConfig()
This is a read-only property.
DiscoveryStatusEnum getDiscoveryStatus()
IEventService getEventService()
java.util.Set<java.lang.String> getScenarioIds()
The returned Set is a shallow copy (new Set) of the scenario Ids.
IScenarioDefinition.getId()
java.util.Set<java.lang.String> getScenarioNames()
The returned Set is a shallow copy (new Set) of the scenario names.
IScenarioDefinition.getDisplayName()
java.util.List<IScenarioDefinition> getScenarios()
The returned List is a shallow copy (new List) of the scenarios.
IScenarioDefinition getScenarioByName(java.lang.String scenarioDisplayName)
scenarioDisplayName
- the ID of the scenario for which the IScenarioDefinition is required.IScenarioDefinition getScenarioById(java.lang.String scenarioId)
scenarioId
- the ID of the scenario for which the IScenarioDefinition is required.void addListener(java.beans.PropertyChangeListener listener)
listener
- The listener to be notified.PROPERTY_SCENARIO_ADDED
,
PROPERTY_SCENARIO_REMOVED
,
PROPERTY_SCENARIO_SERVICE_UNLOADED
,
PROPERTY_SCENARIO_DISCOVERY_STATUS
void addListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- The name of a specific property.listener
- The listener to be notified.PROPERTY_SCENARIO_ADDED
,
PROPERTY_SCENARIO_REMOVED
,
PROPERTY_SCENARIO_SERVICE_UNLOADED
,
PROPERTY_SCENARIO_DISCOVERY_STATUS
void removeListener(java.beans.PropertyChangeListener listener)
listener
- The listener to be removed.PROPERTY_SCENARIO_ADDED
,
PROPERTY_SCENARIO_REMOVED
,
PROPERTY_SCENARIO_SERVICE_UNLOADED
,
PROPERTY_SCENARIO_DISCOVERY_STATUS
void removeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- The name of a specific property.listener
- The listener to be removed.PROPERTY_SCENARIO_ADDED
,
PROPERTY_SCENARIO_REMOVED
,
PROPERTY_SCENARIO_SERVICE_UNLOADED
,
PROPERTY_SCENARIO_DISCOVERY_STATUS
void close()
This will simulate a SenarioServiceUnloaded and cause all EventServiceChannels to be removed and disconnected from the correlator. If an EventService was created implicitly, it also be disposed by this call.
Java client applications should destroy any created scenario services once they are finished using them. To avoid deadlock, this method should never be invoked synchronously from any ScenarioService listener.
This method is invoked automatically on objects managed by the try-with-resources statement.
close
in interface java.lang.AutoCloseable
AutoCloseable.close()
@Deprecated void dispose()
close()
as of Apama version 9.10This will simulate a SenarioServiceUnloaded and cause all EventServiceChannels to be removed and disconnected from the correlator. If an EventService was created implicitly, it also be disposed by this call.
Java client applications should destroy any created scenario services once they are finished using them. To avoid deadlock, this method should never be invoked synchronously from any ScenarioService listener.
@Deprecated void destroy()
close()
as of Apama version 9.10dispose()
method, retained for backwards compatibility only.boolean isDestroyed()
Submit a bug or feature
Copyright (c) 2013-2017 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.