Company
Date Published
Author
Hod Greeley, Developer Advocate, Couchbase
Word count
1309
Language
English
Hacker News points
None

Summary

The text provides an in-depth exploration of setting up and demonstrating replications between Sync Gateway (SG) instances in Couchbase Mobile through a Java application with a Swing-based UI. The author describes running the application alongside two SG instances on a Mac to showcase data synchronization, where JSON data entered in an editing pane is saved to Couchbase Lite (CBL) and subsequently replicated from a primary SG instance to a backup. Configuration details for each SG instance are shared, highlighting the use of different network ports and the special-purpose in-memory database "walrus" for simpler early development. The Java application facilitates monitoring of changes feeds from both SG instances using longpolling with the OkHttp library, and the process of tracking changes using the "last_seq" property is explained. The project, designed for exploration rather than production, is available on GitHub and can run entirely on a single machine to help developers understand the workings of Couchbase Lite, SG, and their replications.