The Sarasvati Engine

Almost all interaction with the Sarasvati will involve an instance of an Engine in some way.

An engine instance does the work of executing process definintions as well as providing access to other APIs, such as the loader.

Sarasvati supports multiple backends, and is packaged with two. Each backend will provide its own Engine impementation.

Table 4.10. Engine Implementations

NameDescription
MemEngine This engine runs only in memory. Workflows must be loaded everytime the JVM starts up. Processes will only survive as long as the JVM is running. Since no database accesses are done, this implementation should provide the best performance.
HibEngine This engine stores process definitions and the state of processes in a database. Communication with the database is handled using Hibernate.


Creating a new MemEngine is straightforward.

  MemEngine engine = new MemEngine();
      

Creating a new HibEngine is only slightly more complicated. It requires a Hibernate Session in order to function.

  HibEngine engine = new HibEngine( session );

  // alternately, the session can be set
  // after construction
  HibEngine engine = new HibEngine();
  engine.setSession( session );