Apama 10.15.0 | Connecting Apama Applications to External Components | Working with Connectivity Plug-ins | Using Connectivity Plug-ins | Creating dynamic chains from EPL
 
Creating dynamic chains from EPL
You can define chains under the dynamicChains section of the configuration file which are not tied to a specific dynamicChainManager. These chains are not created on startup. Instead, multiple instances of these chains can be created on demand from EPL using the ConnectivityPlugins EPL API. There is a static method on the com.softwareag.connectivity.ConnectivityPlugins event type:
createDynamicChain(string chainInstanceId, sequence<string> channels, string chainDefnName, dictionary<string, string> substitutions, string defaultChannelTowardsHost) returns Chain;
Calling this method creates and starts a new instance of a chain defined under dynamicChains and returns a com.softwareag.connectivity.Chain object which can later be used to destroy the chain via the destroy() method.
The arguments to createDynamicChain are:
Argument
Description
chainInstanceId
The identifier to use for the new chain instance. This identifier is used for logging, and it must be unique.
channels
A sequence of channels to which this chain is to be subscribed in the correlator. Events sent to these channels from EPL are delivered to this chain.
chainDefnName
The name of a chain defined under dynamicChains in the configuration file. This must not be for a transport which has a dynamicChainManager.
substitutions
A map of key-value pairs to be substituted into the chain definition using @{key} syntax.
defaultChannelTowardsHost
The default channel to use for sending a message towards the host if no channel is specified on the message. Specify an empty string if you do not want to use a default channel.
Note: 
You must not specify a non-empty value for defaultChannelTowardsHost if the configuration property defaultChannel is also specified for the host plug-in (see also Host plug-ins and configuration). An error will occur in this case.
At the point when createDynamicChain returns, the chain is created and able to receive events. The chain exists until either the correlator is shut down or the .destroy() method is called on the Chain object returned by createDynamicChain.