Returns are one of the most common problems faced by retailers. Returns management software can …
Cloud-native POS platform for seamless omnichannel customer experience.
A single hub for all promotions campaigns.
The most advanced synchronization solution for databases and file systems.
Data configuration and batch automation across different disparate systems and vendors.
Returns are one of the most common problems faced by retailers. Returns management software can …
All sales start with a search. A retailer can do everything right – offering attractive …
In this blazing-fast DevOps world, pushing Point of Sale software updates out to devices in …
With NoSQL databases popping up all over the place, there seems to be a database …
The timestamp data type can cause compatibility issues for cross-platform data replication because database …
When looking into the different types of data storage options in today’s market, one type …
Jumpmind Partners with American Eagle Outfitters to Launch POS of the Future Columbus, Ohio – …
Jumpmind, a leading retail commerce provider, announces the availability of Jumpmind Commerce 4.0 with in-store …
We are thrilled to announce the addition of Clifford Perlman to our leadership team as …
Cloud-native POS platform for seamless omnichannel customer experience.
A single hub for all promotions campaigns.
The most advanced synchronization solution for databases and file systems.
Data configuration and batch automation across different disparate systems and vendors.
In addition to replicating data changes from source to target you may also wish to populate a table on the target to monitor all events. In this blog I will show you how to create a simple load filter that will record all changes captured by SymmetricDS into a simple audit table.
This table will hold just four columns to record the change.
First lets create the audit table on the target node by running the following SQL statement.
create table audit (
table_name varchar(50),
event varchar(1),
pk varchar(50),
pk_columns varchar(250)
);
In the SymmetricDS Pro web console go to the Configure->Load Filters screen
Create a new Load Filter of type BSH with the target table set to * so that all tables setup for replication will be filtered. You will also need to select the appropriate group link, remember the load filter will fire on the target node.
After saving the filter select the edit scripts button.
Select the “After Write Script” from the drop so that the script we will create will fire after each data event is processed.
Provide the following beanshell code to the text editor and hit save.
String tableName = table.getName(); String eventType = data.getDataEventType().getCode(); String[] pkData = data.getPkData(table); String[] pkCol = table.getPrimaryKeyColumnNames(); String pkDataAsString = ""; String pkColAsString = ""; for (int i=0; i < pkData.length; i++) { if (pkDataAsString.length() > 0) { pkDataAsString = pkDataAsString + ","; pkColAsString = pkColAsString + ","; } pkDataAsString = pkDataAsString + pkData[i]; pkColAsString = pkColAsString + pkCol[i]; } String sql = "insert into change_data_events (table_name, event, pk, pk_columns)
values (?,?,?,?)"; engine.getSqlTemplate().update(sql,
new Object[] { tableName, eventType, pkDataAsString, pkColAsString});
Save your script and your all set to start recording change data events into your new table.
Josh has worked in the IT industry for over 20 years as a developer, tech lead, and sales engineer. He has worked across a variety of businesses including retail, telecommunications, education, and healthcare. When he is not developing he enjoys whatever sporting event might be taking place.