Apama API Reference for .NET  9.10.0.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Apama.Services.Scenario.IScenarioService Interface Reference

IScenarioService is an interface that represents the public API to the ScenarioService. More...

Inherits IDisposable.

Public Member Functions

void AddListener (PropertyChangedEventHandler listener)
 Add a PropertyChangeListener that will be notified of changes to any bound property of this object. More...
 
void AddListener (string propertyName, PropertyChangedEventHandler listener)
 Add a PropertyChangeListener that will be notified of changes to a specific named bound property of this object. More...
 
void Destroy ()
 Destroy this service and clean up resources; equivalent to calling Dispose(). More...
 
IScenarioDefinition GetScenarioById (string scenarioId)
 Get a ScenarioDefinition for a specific scenario, using the ScenarioId as the lookup key. More...
 
IScenarioDefinition GetScenarioByName (string scenarioDisplayName)
 Get a ScenarioDefinition for a specific scenario, using the Display name as the lookup key. More...
 
string[] GetScenarioIds ()
 Get the IDs of all known scenarios (not instances) in the correlator. More...
 
string[] GetScenarioNames ()
 Get the Display Names of all known scenarios (not instances) in the correlator. More...
 
IScenarioDefinition[] GetScenarios ()
 Get the ScenarioDefinitions of all known scenarios in the correlator. More...
 
void RemoveListener (PropertyChangedEventHandler listener)
 Remove a PropertyChangeListener that was to be notified of changes to any bound property of this object. More...
 
void RemoveListener (string propertyName, PropertyChangedEventHandler listener)
 Remove a PropertyChangeListener that was to be notified of changes to a specific named bound property of this object. More...
 

Properties

Dictionary< string, object > Config [get]
 Get the configuration properties that define the requested operating semantics of this instance of the service. More...
 
bool Destroyed [get]
 Determine if this service is destroyed. More...
 
DiscoveryStatus DiscoveryStatus [get]
 Get the status of the internal scenario discovery process. More...
 
IEventService EventService [get]
 Get the underlying EventService that is being used by this ScenarioService. More...
 

Detailed Description

IScenarioService is an interface that represents the public API to the ScenarioService.

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:

  1. First obtain an instance of the service via one of the static methods of the ScenarioServiceFactory
  2. Next add one or more listeners such that the client will be notified of new scenarios as they are added.
  3. Finally the client should call either IScenarioService.GetScenarios(), IScenarioService.GetScenarioIds() or IScenarioService.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
ScenarioServiceConstants.PropertyScenarioAdded IScenarioDefinition
ScenarioServiceConstants.PropertyScenarioRemoved IScenarioDefinition
ScenarioServiceConstants.PropertyScenarioServiceUnloaded N/A (always null)
ScenarioServiceConstants.PropertyScenarioDiscoveryStatus

DiscoveryStatus

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.

See also
ScenarioServiceConfig
See also
ScenarioServiceFactory

Member Function Documentation

void Apama.Services.Scenario.IScenarioService.AddListener ( PropertyChangedEventHandler  listener)
void Apama.Services.Scenario.IScenarioService.AddListener ( string  propertyName,
PropertyChangedEventHandler  listener 
)

Add a PropertyChangeListener that will be notified of changes to a specific named bound property of this object.

Parameters
propertyNameThe name of a specific property.
listenerThe listener to be notified.
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioAdded
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioRemoved
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioServiceUnloaded
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioDiscoveryStatus
void Apama.Services.Scenario.IScenarioService.Destroy ( )

Destroy this service and clean up resources; equivalent to calling Dispose().

This will simulate a SenarioServiceUnloaded and cause all EventServiceChannels to be removed and disconnected from the correlator. If an EventService was created implicitly, it will be also disposed by this call.

.NET client applications should destroy any created scenario services once they are finished using them.

IScenarioDefinition Apama.Services.Scenario.IScenarioService.GetScenarioById ( string  scenarioId)

Get a ScenarioDefinition for a specific scenario, using the ScenarioId as the lookup key.

Parameters
scenarioIdthe Id of the scenario for which the IScenarioDefinition is required.
Returns
The ScenarioDefinition interface for the requested scenario.
IScenarioDefinition Apama.Services.Scenario.IScenarioService.GetScenarioByName ( string  scenarioDisplayName)

Get a ScenarioDefinition for a specific scenario, using the Display name as the lookup key.

Parameters
scenarioDisplayNamethe Id of the scenario for which the IScenarioDefinition is required.
Returns
The ScenarioDefinition interface for the requested scenario.
string [] Apama.Services.Scenario.IScenarioService.GetScenarioIds ( )

Get the IDs of all known scenarios (not instances) in the correlator.

The returned string Array is a shallow copy (new List) of the scenario Ids.

Returns

An array of the Ids of all of the scenarios. Each item is a String.

See also
IScenarioDefinition.Id
string [] Apama.Services.Scenario.IScenarioService.GetScenarioNames ( )

Get the Display Names of all known scenarios (not instances) in the correlator.

The returned string Array is a shallow copy (new List) of the scenario names.

Returns

An array of the Display Names of all of the scenarios. Each item is a String.

See also
IScenarioDefinition.DisplayName
IScenarioDefinition [] Apama.Services.Scenario.IScenarioService.GetScenarios ( )

Get the ScenarioDefinitions of all known scenarios in the correlator.

The returned List is a shallow copy (new List) of the scenarios.

Returns
A List of the ScenarioDefinitions of all of the scenarios. Each item is an IScenarioDefinition.
void Apama.Services.Scenario.IScenarioService.RemoveListener ( PropertyChangedEventHandler  listener)
void Apama.Services.Scenario.IScenarioService.RemoveListener ( string  propertyName,
PropertyChangedEventHandler  listener 
)

Remove a PropertyChangeListener that was to be notified of changes to a specific named bound property of this object.

Parameters
propertyNameThe name of a specific property.
listenerThe listener to be removed.
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioAdded
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioRemoved
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioServiceUnloaded
See also
Apama.Services.Scenario.ScenarioServiceConstants.PropertyScenarioDiscoveryStatus

Property Documentation

Dictionary<string, object> Apama.Services.Scenario.IScenarioService.Config
get

Get the configuration properties that define the requested operating semantics of this instance of the service.

Returns
a copy of the scenarioServiceConfig Map that was specified at construction (or an empty Map if none was specified.).
bool Apama.Services.Scenario.IScenarioService.Destroyed
get

Determine if this service is destroyed.

Returns
true if already destroyed, false otherwise.
DiscoveryStatus Apama.Services.Scenario.IScenarioService.DiscoveryStatus
get

Get the status of the internal scenario discovery process.

Returns
a static instance of the enum class DiscoveryStatusEnum to indicate the status.
IEventService Apama.Services.Scenario.IScenarioService.EventService
get

Get the underlying EventService that is being used by this ScenarioService.

Returns
The EventService interface.
Submit a bug or feature
Copyright (c) 2013-2016 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.