Code Monkey home page Code Monkey logo

debezium-pubsub's Introduction

Run MS SQL Server (Developer-version)

Important part is enable MSSQL-agent which maintains all CDC-processes.

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=kissa@2Kossu' -e 'MSSQL_AGENT_ENABLED=true' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest

Create DB and tables

CREATE DATABASE vuoronumerodb;

USE vuoronumerodb;
CREATE SCHEMA [default];


CREATE TABLE [default].turn_number
(
    id         INT IDENTITY,
    office        VARCHAR(255) NOT NULL,
    issued_at DATETIME NOT NULL
                DEFAULT CURRENT_TIMESTAMP,
    done_at DATETIME,
    PRIMARY KEY(id)
);

Enable CDC

Read https://debezium.io/documentation/reference/0.9/connectors/sqlserver.html#how-the-connector-works

GO
EXEC sys.sp_cdc_enable_db
GO


GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'default',
@source_name   = N'turn_number',
@role_name     = NULL,
@filegroup_name = NULL,
@supports_net_changes = 1
GO

Configure debezium app

Edit src/main/scala/pubsubzium/PubSubZium.scala

Run it

sbt run

Add new row into the tracked table:

USE vuoronumerodb;
INSERT INTO [default].turn_number (office) VALUES ('toolon-toimipiste');

Tasks

  1. Modify handleEvent to push JSON-objects into Cloud Pub/Sub
  2. Make it configurable

3. Extra (don't implement yet)

Currently the app uses org.apache.kafka.connect.storage.FileOffsetBackingStore for offset storage. This is file based storage so it's not stateless.

How big deal it is to change this to use some other cloud backed method such as database?

debezium-pubsub's People

Contributors

theikkila avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.