Categorygithub.com/Trendyol/go-dcp-couchbase
modulepackage
1.2.0-rc.1
Repository: https://github.com/trendyol/go-dcp-couchbase.git
Documentation: pkg.go.dev

# README

Go Dcp Couchbase

Go Reference Go Report Card

Go Dcp Couchbase streams documents from Couchbase Database Change Protocol (DCP) and writes to Couchbase bucket in near real-time.

Features

  • Less resource usage and higher throughput.
  • Update multiple documents for a DCP event(see Example).
  • Handling different DCP events such as expiration, deletion and mutation(see Example).
  • **Managing inflight request size to Couchbase.
  • Scale up and down by custom membership algorithms(Couchbase, KubernetesHa, Kubernetes StatefulSet or Static, see examples).
  • Easily manageable configurations.

Concepts

General Concept general

Merge at target bucket merge-buckets

Example

Struct Config

package main

import (
  "github.com/Trendyol/go-dcp-couchbase"
  "time"

  "github.com/Trendyol/go-dcp-couchbase/config"
  dcpConfig "github.com/Trendyol/go-dcp/config"
)

func main() {
  c, err := dcpcouchbase.NewConnectorBuilder(&config.Config{
    Dcp: dcpConfig.Dcp{
      Hosts:      []string{"localhost:8091"},
      Username:   "user",
      Password:   "password",
      BucketName: "dcp-test",
      Dcp: dcpConfig.ExternalDcp{
        Group: dcpConfig.DCPGroup{
          Name: "groupName",
          Membership: dcpConfig.DCPGroupMembership{
            RebalanceDelay: 3 * time.Second,
          },
        },
      },
      Metadata: dcpConfig.Metadata{
        Config: map[string]string{
          "bucket":     "dcp-test-meta",
          "scope":      "_default",
          "collection": "_default",
        },
        Type: "couchbase",
      },
      Debug: true,
    },
    Couchbase: config.Couchbase{
      Hosts:          []string{"localhost:8091"},
      Username:       "user",
      Password:       "password",
      BucketName:     "dcp-test-backup",
      RequestTimeout: 10 * time.Second,
    },
  }).SetMapper(dcpcouchbase.DefaultMapper).Build()
  if err != nil {
    panic(err)
  }

  defer c.Close()
  c.Start()
}

Configuration

Dcp Configuration

Check out on go-dcp

Couchbase Specific Configuration

VariableTypeRequiredDefaultDescription
couchbase.hosts[]stringyesCouchbase connection urls
couchbase.usernamestringyesDefines Couchbase username
couchbase.passwordstringyesDefines Couchbase password
couchbase.bucketNamestringyesDefines Couchbase bucket name
couchbase.scopeNamestringno_defaultDefines Couchbase scope name
couchbase.collectionNamestringno_defaultDefines Couchbase collection name
couchbase.maxInflightRequestsintno2048Maximum message count for Couchbase
couchbase.writePoolSizePerNodeintno1Write connection pool size per node
couchbase.requestTimeouttime.Durationno3sMaximum request waiting time
couchbase.secureConnectionboolnofalseEnables secure connection.
couchbase.rootCAPathstringnofalseDefines root CA path.
couchbase.connectionBufferSizeuintno20971520Defines connectionBufferSize.
couchbase.connectionTimeouttime.Durationno5sDefines connectionTimeout.

Exposed metrics

For DCP related metrics see also.

Breaking Changes

Date taking effectDate announcedChangeHow to check
December 29, 2023December 29, 2023Mapper first arg changed to couchbase.EventContextCompile project
November 14, 2023November 14, 2023Creating connector via builderCompile project

Contributing

Go Dcp Couchbase is always open for direct contributions. For more information please check our Contribution Guideline document.

License

Released under the MIT License.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author