Hi everyone. This is my first post here in the community forums, pleased to meet everybody.
I’m working on a custom integration to an external system. Basically, idea is we will have a custom connector that will bridge the gap between my external system and Sync Gateway. Something like this (i took this diagram from another thread somewhere):
External system is system of record. Couchbase Mobile is used as a mechanism to perform sync to/from mobile clients.
Changes can come both from my External System or from the CouchbaseLite clients, and should be synchronized either direction - 2 way sync between Couchbase and External system.
Changes from External System to Couchbase
I can push inserts, updates, deletes from External System into Couchbase through Sync Gateway using the “document” API endpoint (POST, PUT, DELETE, GET). So far so good. I have this working.
Changes from Couchbase to External System
Now, i need to be able to detect changes in Couchbase, and sync those changes to External System. Everything points to using the “_changes” feed for the “database” API endpoint. What i cannot figure out is how to filter out changes coming from external system itself. Say, a new record R1 is POSTed to Sync Gateway by my custom connector. Next time i download changes from _changes feed, that record R1 will be part of the feed (even though, technically, from the perspective of External System, it is irrelevant, as that change actually came from External System).
Is there a way to avoid that? Do i need to come up with my own mechanism to filter out those changes, to avoid “bounces” (change coming from External System is exposed in _changes feed to be consumed by…External System).
Am i going the right direction here?
Thanks for your kind help.