Developing Apama Applications > Using Apama Studio > Creating Blocks > Defining new blocks in Apama Studio > Creating parallel-aware blocks
Creating parallel-aware blocks
If you want a parallel scenario to use a block, you must mark that block as parallel-aware. You do this in the Builder tab of the block builder editor in Apama Studio. Select the block name. Then select the Parallel-aware checkbox near the bottom of the Builder tab fields.
The correlator runs each instance of a parallel scenario in a separate context. For information about contexts, see Implementing Parallel Processing in Developing Apama Applications in EPL.
When you mark a block you are creating as parallel-aware it means that you are taking responsibility for ensuring that the block functions correctly when run in multiple contexts. Blocks that do not listen for events are trivially parallel-aware since running in another context has no effect on that block. All of the block’s interactions are mediated by the scenario.
Blocks that listen for events must ensure that the events they are listening for actually reach the context they are in. You can achieve this by storing a reference to the main context during the instancePreSpawnInit() action. Use this reference to inform services running in the main context where they should send events. Look at the Market Depth standard block for a good example of this.
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.