Developing Apama Applications > Using Apama Studio > Creating Blocks > Defining new blocks in Apama Studio > Considerations for adding EPL code to the block definition
Considerations for adding EPL code to the block definition
As you add custom code to your block, keep the following in mind:
*The # character denotes special names that will subsequently be assigned automatically by the code generator. Therefore, do not use the # character anywhere else in your EPL files, including within comments.
*You must not call die() anywhere in the block event type definition. Consequently you should not call spawn() in the block event type definition as you would have no way of terminating the new monitor instance.
In situations where you might want to spawn from within a block, use a utility monitor that is part of the block’s definition instead. Insert the EPL code for a utility monitor in the USER DEFINED MONITORS section of your block definition file. For example, suppose your block subscribes to one or more market data feeds and you want to track data and status messages that result from each subscription. Write a utility monitor that listens for events related to the subscriptions and caches values that result from subscription operations. You can call die() in this monitor without affecting the block or the scenario.
*If the EPL code in your block causes a runtime error, for example you attempt a division by zero or you attempt to access an out of bounds index in a sequence or dictionary, the scenario monitor will be terminated by the correlator.
See also Timeliness of acknowledgements.
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.