forked from yugabyte/yugabyte-db
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CDCSDK] [yugabyte#9019] CDC SDK Client API and Java Console Subscriber
Summary: Github Master Ticket: yugabyte#9019 Design DocumentL https://docs.google.com/document/d/1_xZqU5UgzCu1W--kci3ajU7_iYXXHMQvudmybDI-Xsk/edit Functional Spec: https://docs.google.com/document/u/2/d/1nHuzHQ-qYVPbKi2dqo_drzSXMq00h7w5oi0JDf0GD1U/edit#heading=h.jmqfs7jgvvg8 This is the client-side change that exposes some APIs to be consumed by CDC consumers. Currently, these APIs are not public and are to be consumed by our Debezium connector. For testing purposes, we have written a console subscriber for testing purposes. Test Plan: Unit tests in java for APIs and CDC behavior. We have done some long-running testing with applications. We have also run the YB-sample apps and enabled CDC on the table. Verified that all the events are received. Reviewers: nicolas, bogdan, ybase, ashetkar, nkumar, nikhil, rahuldesirazu Reviewed By: rahuldesirazu Subscribers: vkushwaha, srangavajjula Differential Revision: https://phabricator.dev.yugabyte.com/D13836
- Loading branch information
Showing
84 changed files
with
8,454 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
java/yb-cdc/src/main/java/org/yb/cdc/CDCConsoleSubscriber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
// or implied. See the License for the specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
package org.yb.cdc; | ||
|
||
import org.apache.log4j.*; | ||
|
||
public class CDCConsoleSubscriber { | ||
private static final Logger LOG = Logger.getLogger(CDCConsoleSubscriber.class); | ||
|
||
private ConcurrentLogConnector connector; | ||
|
||
public CDCConsoleSubscriber(CmdLineOpts cmdLineOpts, OutputClient opClient) throws Exception { | ||
connector = new ConcurrentLogConnector(cmdLineOpts, opClient); | ||
} | ||
|
||
public void run() { | ||
try { | ||
connector.run(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
LOG.error("Application ran into an error: ", e); | ||
System.exit(0); | ||
} | ||
} | ||
|
||
public void close() { | ||
try { | ||
connector.close(); | ||
} catch (Exception e) { | ||
System.exit(0); | ||
} | ||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
LOG.info("Starting CDC Console Connector..."); | ||
|
||
CmdLineOpts configuration = CmdLineOpts.createFromArgs(args); | ||
try { | ||
CDCConsoleSubscriber subscriber = new CDCConsoleSubscriber(configuration, new LogClient()); | ||
subscriber.run(); | ||
} | ||
catch (Exception e) { | ||
e.printStackTrace(); | ||
System.exit(1); | ||
} | ||
} | ||
} |
Oops, something went wrong.