Developing Apama Applications > Developing Apama Applications in EPL > Implementing Parallel Processing > Creating contexts
Creating contexts
In EPL, you refer to a context by means of an object of type context. The context type is a reference type. Context objects are lightweight and creating one only creates a stub object and allocates an ID. In other words, when you create a context, you are actually creating a context reference.
Use one of the following constructors to create a context:
context(string name)
context(string name, boolean receivesInput)
The optional receivesInput Boolean flag controls whether the context is public or private:
*true — Indicates a public context. The default behavior is that a public context receives events from the default channel, which is the empty string ("").
*false — Indicates a private context. This is the default. A private context receives events from only those channels that monitor instances in that context subscribe to.
The recommendation is to use private contexts and have monitor instances subscribe to the channels they require events from. This gives greater flexibility over using public contexts.
The following example creates a reference, c, to a private context whose name is test:
context c:=context("test");
The following topics provide additional information:
*Calling context methods
*How many contexts can you create?
Copyright © 2013-2015 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.