Book is the abstract base class for all feed handler books. It manages level 1 and
level 2 market data received from a market feed. Subclasses of book implement specific
storage strategies for this information. Book also provides the infrastructure
required by a feed handler to load and initialize books.
Level 1 market data is represented by instances of the class SymbolData.
Level 2 market data is represented by instances of the class OrderData.
Stop this book. The book's shutdown flag is set, which should inform any threads
operating in this book to halt processing and exit. Subclasses may extend this
method in order to perform any required cleanup, but should call this version to
do thread cleanup.
Start this book. This method may be overridden by subclasses. This method is called
from a module controller in order to initiate book processing. Any threads should be
started, resources allocated etc. After this call the book should process updates and
subscriptions until stop is called.
Stop and then start this book. This will be called by a module controller in order to
recover from an error or reinitialize the application. Any exceptions are ignored, which
is probably not right and will most likely change.
Initialize this book. A module controller will call this method in order to allow the
book to process properties from its configuration section. Subclasses of book may
override this method in order to process custom configuration properties, but should
always call this version. Currently the only configuration property supported is the
boolean 'l2enabled' flag. Note that init requires that the Mapper instance for the
feed handler must already exist and be initialized. This requirement will most likely
change in the future.
Process a message block incoming from a feed source. Each feed message contained in the
message block will be iterated through. For each one the abstract method
processUpdate(FeedMessage,String) will be invoked and Mapper.updateList(List)
will be called and passed the resulting list of updates. If a feed message is of type
Message.UNKNOWN it will be ignored. If it is of type MessageType.INVALID the abstract
method bookIsBad() will be invoked. Once the message block is processed its release()
method will be called.
Notifies an instance of a feed interface module that some client is no longer
interested in particular market data. As with the subscribe method this may or may not
result in any action being taken depending on the particular feed.
Processes an incoming subscription for a symbol. Calls getSymbolData(String) to find
any level 1 data associated with the symbol being subscribed and if any exists calls
SymbolData.getLevel2Snapshot() or SymbolData.getLevel1Snapshot() to generate a list
of updates representing all known information for that level and symbol, then calls
Mapper.updateSubscription(Subscription,List) to post the snapshot back to the