This topic describes the actions you can take on each tab of the Metronome operator's Properties view.
The Metronome delivers output tuples periodically based on the system clock, at an interval that you specify. In the same way that a musician's metronome can be used to indicate the exact tempo of a piece of music, you can use the StreamBase Metronome operator to control the timing of downstream operations by a connected component.
For example, the following EventFlow shows a Metronome being used to emit a timer tuple every five seconds. In effect, the read operation of the connected Query operator will occur at that interval. The read operation is a lookup of the current share Price from the NameValuePairs Query Table:
A Metronome operator does not receive any input tuples, has zero input ports, and therefore does not pay attention to timestamp fields. Each Metronome operator has one output port. Unlike the related Heartbeat operator, the Metronome operator does not provide a slack property, which means there is no variance in the emit interval for each timer tuple.
You might use a Metronome operator to activate one flow in your StreamBase application on a periodic basis, because a consumer of an output stream is unable to keep up with the speed that data enters into, and is processed by, StreamBase.
A StreamBase application can have one or more Metronome operators, each with different timing values. You can also have a StreamBase application that uses one or more Metronome operators plus one or more Heartbeat operators. Think of a StreamBase Heartbeat operator as another type of timing mechanism. Unlike the Metronome operator, a Heartbeat operator's pulse can vary (like a person's beating heart, which can speed up or slow down). You can specify the amount of variance or slack that is allowed by the Heartbeat operator.
Name: Every application component must have a unique name. Use this field to specify or change the component's name. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.
Enable Error Output Port: Check this box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports and Error Streams to learn about Error Ports.
Description: Optionally, enter a description to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.
The Output Settings tab allows you to specify:
- Tuple output interval
-
Specifies how often a timer tuple is to be emitted to the next downstream component. You can enter integers or decimal values such as
.10, meaning ten times per second. The lowest supported granularity is 10 milliseconds, or.01, meaning 100 times per second. If you enter a value lower than .01, such as.009, StreamBase Studio displays the following error:The Tuple Output Interval you entered may be too fine-grained to be guaranteed.
If you enter
0(zero), or a number below .0005 (which effectively rounds to zero), StreamBase Studio displays the following error:The Tuple Output Interval must be a numeric value greater than zero.
- Output field name
-
Specifies the name of the single field that will comprise the timer tuple. The type is always a timestamp, and the value is always the current time when each Metronome tuple is emitted.
- Run this component in a separate thread
-
This option causes the server to process the component's requests concurrently with other processing in the application. You can distribute the processing of the threads automatically across multiple processors on an SMP machine.
If this is a compute-intensive component and you know that it can run without data dependencies on other components in the StreamBase application, you may be able to improve performance by enabling this option.
Caution
These features are not suitable for every application. For details, see Execution Order, Concurrency, and Parallelism. It includes important guidelines for the use of these features.
- Run in parallel threads
-
If you checked the first option, you can also choose this option, which causes the server to run multiple instances of this component. That is, each instance runs in its own thread. At run time, tuples are dispatched to particular instances based on the Key Expression value (which must evaluate to an int).
