Writing echo monitors for debugging
A common practice is to write an echo monitor for debugging purposes. Typically, an echo monitor listens for the same events as your production monitor and tracks various behavior.
Writing an echo monitor is typically straightforward, but keep the following caveat in mind. If your production monitor uses the unmatched keyword for a certain event, and your echo monitor listens for the same event, and both monitors are in the same context, your unmatched event listener will never trigger. This is because the event listener in the echo monitor matches the event and this prevents the unmatched event listener from ever triggering. The scope of an unmatched event listener is the context that it is in.
To avoid an unmatched event listener that never triggers, specify the completed keyword in the event listener in the echo monitor. For example, suppose you have the following code in your production monitor:
on all unmatched SubscribeDepth():subDepth {
doSomething();
}
If you want to track SubscribeDepth events in your echo monitor, write the event expression in the echo monitor as follows:
on all completed SubscribeDepth():subDepth {
doSomethingElse();
}
The completed event listener in the echo monitor triggers after the correlator finishes processing the unmatched event listener in the production monitor.