Code examples

This feature has been released as a public beta in AuraDB Enterprise October Release and Neo4j Enterprise Edition 5.13 and breaking changes are likely to be introduced before it is made generally available (GA).

This section provides examples of a simple application using the CDC procedures. The examples are provided separately for each of the supported language libraries.

Cursor management and server side filtering

The change identifiers returned from the CDC procedures are valid until Neo4j rotates the transaction log.

Usually the change cursor stays valid, since each call to db.cdc.query updates the cursor. However, very strict selectors may cause db.cdc.query to not return any changes. This can in extreme cases lead to the cursor not being updated in time before the transaction log are rotated. To avoid this, the code examples update the cursor to db.cdc.current if db.cdc.query returns empty. Note that db.cdc.current needs to be called and stored before calling db.cdc.query for this to work.

Another way to avoid this issue is to use broader selectors and perform client side filtering instead.