Deploying Couchbase Eventing

In order to process events on Couchbase NoSQL database GlueSync needs that the eventing service is deployed inside the cluster and available. Eventing service is needed to run GlueSync Eventing functions. Those functions will generate events based on changes that happen on Couchbase documents in a particular bucket. GlueSync then will process those events and replicate data into the destination database.

How to size your cluster deployment

To properly define the sizing and number of nodes needed to provide that functionality our professional services can be involved opening a ticket to the support team.

Automatic Eventing functions deploying

GlueSync automatically deploys the following Eventing functions inside your Couchbase Cluster deployment at its first initialisation. Each function has a prefix gluesync_ word to be easily recognised inside your Eventing deployment. As per you can have multiple GlueSync instances running into your Couchbase Server cluster.

When deploying GlueSync targeting a bucket shared with a Couchbase Sync Gateway you will need an additional configuration before starting the connector. Please refer to this page to learn more.

Eventing function gluesync_${configuration.sourceName}_generate_document_event

Generates an event from a JSON document change notification and writes it inside the helper bucket. This function uses the GlueSync’s config JSON document mentioned below to retrieve the list of docTypes to monitor.

Eventing function gluesync_${configuration.sourceName}_save_event_to_target

Takes the saved event and writes it into the source bucket where it will be consumed by GlueSync.

Understanding GlueSync’s config JSON (Document types list)

GlueSync will store a specific JSON document into your “Data bucket” in order to let you catch events coming from the specified JSON document type’s key; it can be easily recognised thanks to its type property __gluesync_config_doc.

Config JSON document has basically this simple structure:

{
  "sourceEntities": ["orders","DocumentType2","DocumentType3","DocumentType4"],
  "type": "__gluesync_config_doc"
}
Leaving the mentioned document empty will let the eventing function generate an event for every document type that gets changed inside your “Data bucket”.
do not manually edit this document, it is automatically managed by the GlueSync connector.

Understanding GlueSync’s migration flag

GlueSync will store a specific JSON document into your “Data bucket” in order keep trace of the first migration before enable tracking of changes. This is usefull to know if migration already happened in case of restart or retry. The id of the document is __gluesync_migration_doc.

JSON document has basically this simple structure:

{
  "migratedEntities": ["orders","DocumentType2","DocumentType3","DocumentType4"]
}

Understanding GlueSync’s events counter

GlueSync will store a specific JSON document into your “Data bucket” in order keep a counter to processed events. This is usefull to have a checkpoint in case of restart or retrye. The id of the document is __gluesync_events_counter.

JSON document has basically this simple structure:

{
  "count": 1234
}