In this tutorial you will implement a Validator application that queries the space for account objects showing the different query methods GigaSpaces offers.

Application Components

There are three main components in our workflow:

  • Enterprise Data Grid space instance
  • Feeder
    1. Writes an initial amount of accounts to the space.
    2. Starts cycles of feeding new order objects to the space, each order is labeled Insecure or Normal.
  • Validator
    1. Starts query-based polling of Normal orders from the space, validates according to the relevant account and writes the order back to the space as approved/rejected.
    2. Registers for query-based notifications on Insecure orders, performs read on notify, holds a counter that is increased each time an Insecure order with risk higher then allowed (compared to a relevant account) is read.

Two additional components are:

  • Counter - Counts the number of Insecure orders that are riskier then allowed according to their corresponding account (Demonstrates use of GSIterator).
  • Scripting Counter - Counts number of Insecure orders with risk attribute higher then a fixed risk factor (Demonstrates use of Scripting).
    Scripting Counter is available only from GigaSpaces 6.5 and onwards.

Application Workflow

The application workflow is as follows:

  1. The Feeder PU's Pre-Loader service pre-loads the space with 100 account objects.
  2. After the Pre-Loader finishes, the Feeder Service starts cycles of feeding the space with new order objects with type Normal or Insecure.
  3. The Validator PU polling container continuously tries to take from the space new Normal orders, using a query template.
    The Validator notify container is registered for query-based notification, for every New and Insecure order written to the space.
  4. Once a Normal order is taken by a the polling container, the Normal Validator service validates it by querying the space for the relevant account for the order.
    When a notification is received by the notify container about a written Insecure order to the space, the Risky Counter service examines it by querying the space for the relevant account for the order. its counter is increased if the account allowed risk is sufficient for the order.
    (The Validator Service and Counter Service uses different query and query types (Directly Parameterized Query/Template Based Query)
  5. The order is validated and marked as approved if an account matching the query is found, otherwise it is marked as rejected. After validation is complete, the order is written back to the space.

The Scripting and GSIterator based components are described individually in the following sections:

GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence