Americans spent $135.5 billion on back-to-school and back-to-college shopping in 2023, making the season a …
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.
Americans spent $135.5 billion on back-to-school and back-to-college shopping in 2023, making the season a …
Google may have introduced the concept of micro-moments almost ten years ago, but year after …
We’ve all heard the words omnichannel and seamless shopping by now…but achieving it can be …
Sybase ASE (more recently known as SAP Adaptive Server Enterprise), announced its end of mainstream …
Azure Blob Storage has become a popular option for storing files in the cloud. And …
SymmetricDS now supports loading data and changes into RabbitMQ, so you can capture changes in …
Jumpmind Powers Point of Sale and Promotions Execution for Landmark Retail, One of the Largest …
Retail Technology Leader Jumpmind to Enable Mobile Point of Sale and Inventory Management for DTLR/VILLA …
The retailer is charting its next chapter with retail technology modernization to power inspired omnichannel …
Jumpmind Powers Point of Sale and Promotions Execution for Landmark Retail, One of the Largest …
Jumpmind Launches The Jumpmind Cloud, Powered by Amazon Web Services New Offering Provides Newfound Application …
Retail Technology Leader Jumpmind to Enable Mobile Point of Sale and Inventory Management for DTLR/VILLA …
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.