forwardError Handling and Recovering   Table of ContentAdvanced Programmingforward
Understanding Handler States

Once the Handler is started, it processes securities definitions retrieved from TCP connection. Afterwards, the Handler starts listening for a book-related market data. At first, the Handler reconstructs all the books for all available securities. Once reconstruction is accomplished, the Handler listen for an incremental updates and processes them accordingly.

Handler States

The table below describes all possible states for the Handler:

Stopped The Handler is stopped or was not executed yet.
Stopping The Handler is stopping.
Started The Handler is started, but no data processing is performed yet.
SecurityDefinitionsRecoveryStarted The Handler started gathering product definitions from TCP stream.
SecurityDefinitionsRecoveryFinished The Handler accomplished processing of product definitions. In normal flow Handler moves to the BooksResynchronizationStarted right after it achieves SecurityDefinitionsRecoveryFinished state. However, in certain cases (for example, in case of error while processing product definitions) the Handler may move to the Stopping state.

The Handler switches to this state when it joins the system for a market data and starts building the books for all securities whose definitions were obtained on previous stage. Also, the Handler may move into this stage in case of message GAP detection while maintaining books.

Note Note

Once the Handler moves into this state, books of all types for all securities are no longer valid and are wiped by the Handler. Since this moment Handler starts to rebuild all books from the scratch.

BooksResynchronizationFinished The Handler accomplished process of the book recovery. Since this moment all the books are valid and are in the up-to-date state. The Handler continues to listen for any changes in the books and notifies about updates through appropriate listeners.
Handler States Diagram

Handler States