mancini0
mancini0

Reputation: 4733

Consuming cockroachdb changefeed via JDBC

Is it possible to consume "EXPERIMENTAL CHANGEFEED FOR" (core) type queries over JDBC?

Is it possible to consume "CREATE CHANGEFEED FOR" (enterprise) type queries over JDBC?

Upvotes: 1

Views: 360

Answers (1)

Roland Crosby
Roland Crosby

Reputation: 63

thanks for your interest in CockroachDB changefeeds. Enterprise changefeeds should work fine with JDBC or any other SQL driver: the CREATE CHANGEFEED statement sets up the changefeed to deliver data to a Kafka or cloud storage target, and immediately returns a job ID that you can use to monitor the health of the changefeed via the SHOW JOBS statement or the web UI.

Core changefeeds work a little differently from other SQL statements: when you issue a CHANGEFEED FOR statement, CockroachDB streams results back indefinitely and never returns unless something goes wrong or the query is canceled. Currently, this streaming behavior isn't implemented in the way that the Postgres JDBC driver expects (see #4035 and the linked work-in-progress PRs), so consuming results using Postgres JDBC cursors won't work. We're working on adding support for this.

Upvotes: 1

Related Questions