Giter Club home page Giter Club logo

go-dcp-client's Introduction

Go Dcp Client

This repository contains go implementation of a Couchbase Database Change Protocol (DCP) client.

Contents


Why?

  • Our main goal is to build a dcp client for faster and stateful systems. We want to use this repository in below implementations:
    • Couchbase Elastic Connector
    • Kafka Connector

Example

package main

import (
	"log"

	"github.com/Trendyol/go-dcp-client"
)

func listener(event interface{}, err error) {
	if err != nil {
		log.Printf("error | %v", err)
		return
	}

	switch event := event.(type) {
	case godcpclient.DcpMutation:
		log.Printf("mutated | id: %v, value: %v | isCreated: %v", string(event.Key), string(event.Value), event.IsCreated())
	case godcpclient.DcpDeletion:
		log.Printf("deleted | id: %v", string(event.Key))
	case godcpclient.DcpExpiration:
		log.Printf("expired | id: %v", string(event.Key))
	}
}

func main() {
	dcp, err := godcpclient.NewDcp("config.yml", listener)
	if err != nil {
		panic(err)
	}

	defer dcp.Close()

	dcp.Start()
}

Features

  • Metrics calculator
  • Kubernetes StatefulSet membership
  • Kubernetes High Availability
  • Auto membership
  • Durable connection
  • Auto restart

Usage

$ go get github.com/Trendyol/go-dcp-client


Configuration

Variable Type Is Required
hosts array yes
username string yes
password string yes
bucketName string yes
scopeName string no
collectionNames array no
metadataBucket string no
dcp.group.name string yes
dcp.group.membership.type string yes
dcp.group.membership.memberNumber integer no
dcp.group.membership.totalMembers integer no
api.port integer no
metric.enabled boolean (true/false) no
metric.path string no
leaderElection.enabled boolean (true/false) no
leaderElection.type string no
leaderElection.config string/string key value map no
leaderElection.rpc.port integer no
logger.level string no
checkpoint.type string no
checkpoint.interval integer no
checkpoint.timeout integer no

Examples

go-dcp-client's People

Contributors

erayarslan avatar canerpatir avatar mstryoda avatar gulumseraslann avatar mhmtszr 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.