Introduced event based flush and generalized the existing code for future spool processors.