Apama API Reference for .NET  10.7.1.2
Apama.Services.Scenario.IScenarioService Interface Reference

The Scenario Service is an API for interacting with Apama applications from custom clients and dashboards running outside the correlator. 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

The Scenario Service is an API for interacting with Apama applications from custom clients and dashboards running outside the correlator.

For example, it can be used to listen for updates from applications that expose data through DataViews, or to create/edit/delete instances of queries.

Create an IScenarioService instance using the ScenarioServiceFactory. The PropertyChangedEventHandler specified when the service is created will receive an asynchronous ScenarioServiceConstants.PropertyScenarioAdded notification for each available IScenarioDefinition as soon as the service successfully connects to the correlator, which you can use to create/edit/delete scenario instances, or to add a listener for the parameters of each IScenarioInstance.

The Scenario Service is built on the Apama.Services.Event.IEventService and is thread-safe. Note that unlike other parts of the Apama API, Scenario Service listener callbacks can 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

◆ AddListener() [1/2]

void Apama.Services.Scenario.IScenarioService.AddListener ( PropertyChangedEventHandler  listener)

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

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

Parameters
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

◆ AddListener() [2/2]

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.

See AddListener(PropertyChangedEventHandler) for details about the property change events.

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

◆ Destroy()

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.

◆ GetScenarioById()

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.

◆ GetScenarioByName()

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.

◆ GetScenarioIds()

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

◆ GetScenarioNames()

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

◆ GetScenarios()

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.

◆ RemoveListener() [1/2]

void Apama.Services.Scenario.IScenarioService.RemoveListener ( PropertyChangedEventHandler  listener)

◆ RemoveListener() [2/2]

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

◆ Config

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.).

◆ Destroyed

bool Apama.Services.Scenario.IScenarioService.Destroyed
get

Determine if this service is destroyed.

Returns
true if already destroyed, false otherwise.

◆ DiscoveryStatus

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.

◆ EventService

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-2021 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.