streamcruncher.test.func.generic
Class ReStockAlertTest

java.lang.Object
  extended by streamcruncher.test.func.OrderGenenerator
      extended by streamcruncher.test.func.generic.ReStockAlertTest
Direct Known Subclasses:
ReStockAlertPerfTest

public abstract class ReStockAlertTest
extends OrderGenenerator

Another example to show how normal Tables containing Master-Data can be used to drive the behaviour of the Query.

This example receives Events containing the Orders placed by Customers which deplete the Stock and Events containing the quantity of Stock that was replenished. There is a normal DB Table, which store the minimum quantity of each Product, that the Store must have in stock. When the stock at "Country > State > City > Item SKU" level dips below the specified limit, an Alert is sounded.

The Product quantity is stored in a "Latest Rows/Events Window". However, the Events expire in the next cycle in such Windows. When the Window is empty, it is destroyed and the Aggregates are also lost. To avoid this, the Windows are pinned in the Memory and stay there even if the Window is empty. But the Aggregate values will be stored safely to maintain continuity.

Since this Stream brings in both Consumption Events and Re-stock Events, with +/- values, the sum total of all Events that enter the Window must be calculated and pinned. However, in a normal Window when an Event expires, its contribution to the Aggregate will be recalled and the Aggregate will be recalculated. In this case we want to maintain the total and not the moving-sum. So, only the Event entrances are allowed to affect the Aggregate by using the entrance only clause.


Constructor Summary
ReStockAlertTest()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReStockAlertTest

public ReStockAlertTest()


Copyright © 2006 - 2008 Ashwin Jayaprakash. All Rights Reserved. (Docs generated on 3-November-2007 )