This sample describes how to build an EventFlow fragment suitable for 2-node active standby deployment.
- Store tuples in a query table backed by transactional memory
- Design notes
- Running this sample from Spotfire StreamBase Studio™
- Building this sample from Spotfire StreamBase Studio™ and running the unit test cases
- Building this sample from the command line and running the unit test cases
In this sample, a query table is used to update, read and delete tuples, so :
- Query table is key'ed by name field
- A tuple injected on the UpdateStream stream containing name & value will insert or update the name entry in the table with the new value
- A tuple injected on the ReadStream stream containing name will read the current value from the table
- A tuple injected on the DeleteStream stream containing name will delete the name from the table
The query table is configured with transactional memory :
A data distribution policy static-data-distribution-policy is set ( to be later defined in the application definition configuration file ) :
Finally, the tuples stored in the query table are partitioned by the name field :
Processing is always on the local node, hence :
- Routing to a remote node is not required
- Query scope is local ( ie not cluster wide )
Use the Run As -> EventFlow Fragment menu option to run in Spotfire StreamBase Studio™, and then enqueue tuples :
Note that here we are unit testing the business logic rather than high availability - in this sample we test high availability in the application archive integration test cases. The unit test cases can test high availability by loading an activating test versions of the application definition and node deployment configuration files.
Use the Run As -> EventFlow Fragment Unit Test menu option to build from Spotfire StreamBase Studio™ :
Use the maven as mvn install to build from the command line or Continuous Integration system :
Copyright (c) 2018-2023 Cloud Software Group, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.