Picture this, you have a business that is selling those wildly popular tablets, and you want to know when you need to order more. With continuous query, you will actually be notified this is happening in your grid if you setup the correct query saying, let me know when quantity is < 10. You can then send off a task to get more in stock, upgrade the value in the grid to out of stock, or increase the price! This gives you the power to react to what's happening without having to watch mounds of data trying to figure out what is going on.
The getting started with Continuous Query sample is provided for a quick introduction to the Continuous Query filtering. It consists of shell and batch scripts designed to start a simple grid with very little customization needed. The sample shows how to filter results automatically with WebSphere eXtreme Scale data grid. Add this to your XC10 Appliance, and you have a quick way to automatically be notified what's in your grid so that your application can react appropriately.
Running the sample as a client for XC10
1. Create a Simple Data Grid and Map on the XC10 console
Sign into the console
Click Data Grid->Simple Data Grid
Click the plus sign for a new Grid.
Give the Grid a Name.
2. Edit your env.bat or env.sh
Change the CATALOGSERVER_HOST and CATALOGSERVER_PORT to point to your XC10 machine.
Change the CATALOG_SERVICE_ENDPOINTS to point to your XC10 machine.
Change the GRID_NAME, MAP_NAME and COORD_MAP_NAME to what you gave your Grid Name.
An example would be GRID_NAME = Grid
MAP_NAME = Grid.CT
COORD_MAP_NAME = Grid.NONE
3. Open a terminal or command-line window:
Windows: set JAVA_HOME=<java home>
UNIX: export JAVA_HOME=<java home>
4. CD <installRoot>/ObjectGrid/samples/ContinuousQuery
5. Run the filter test:
Windows: runclient.bat filter
UNIX: ./runclient.sh filter
"Starting the Continuous Query Demo
Run the CQDemoGridWorker now..."
6. In another terminal, in the same directory, <installRoot>/ObjectGrid/samples/ContinuousQuerySample run the Worker test:
Windows: runclient.bat worker
UNIX: ./runclient.sh worker
The filter client will define a continuous query that should find anyone with first name Larry. As soon as the
worker client inserts this object into the grid, the filter finds it and prints it out.
The cache now contains the one existing customer named Larry.
Walk through the code and demo output to see more examples of the continuous query feature.
For information on loading and running this client in Eclipse,
refer to the provided ECLIPSE_README.txt file. You can use the Eclipse environment
to update and compile the sample and run the sample programmatically.
Please post any feedback on this sample as a comment on this page.