Developing Apama Applications > Developing Apama Applications in EPL > Implementing Parallel Processing > Introduction to contexts > Comparison of a correlator and a context
Comparison of a correlator and a context
Upon injection, each monitor’s initial instance runs in the main context. You must explicitly create additional contexts. Conceptually, a context is like a correlator, however, a correlator has a few special properties:
*It is always public.
*The name is always main.
*It always exists.
*It is the context where onload() is run.
*It is the only context where Java applications can run.
All contexts share the same namespace, and thus share all monitor and event definitions that have been injected. A monitor instance must have a context reference to pass an event to that context.
There is one queue of enqueued events for all contexts. When you specify the enqueue command (not the enqueue...to command), the enqueued event goes to the special queue for enqueued events. The correlator then places the event on the input queue of each public context. The correlator ensures that an enqueued event always arrives on the appropriate input queue(s). An enqueue operation never blocks. However, if the input queue of a context is full and the enqueued events queue gets very large, the result can be an unbounded memory usage error.
The engine_receive utility receives events from all contexts.
The engine_send utility sends events to all contexts that have been set to receive external events, that is, all public contexts.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.