From cc4c0eba6a979825d04ac7abe21d47ccb4e5448c Mon Sep 17 00:00:00 2001 From: Eray Arslan Date: Thu, 16 May 2024 16:35:09 +0300 Subject: [PATCH] chore: readme update --- README.md | 92 +++++++++---------- .../main.go | 2 +- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 9694adc..14a2ed2 100644 --- a/README.md +++ b/README.md @@ -38,53 +38,53 @@ used for both connectors. ```go func mapper(event couchbase.Event) []document.ESActionDocument { -if event.IsMutated { -e := document.NewIndexAction(event.Key, event.Value, nil) -return []document.ESActionDocument{e} -} -e := document.NewDeleteAction(event.Key, nil) -return []document.ESActionDocument{e} + if event.IsMutated { + e := document.NewIndexAction(event.Key, event.Value, nil) + return []document.ESActionDocument{e} + } + e := document.NewDeleteAction(event.Key, nil) + return []document.ESActionDocument{e} } func main() { -connector, err := dcpelasticsearch.NewConnectorBuilder(config.Config{ -Elasticsearch: config.Elasticsearch{ -CollectionIndexMapping: map[string]string{ -"_default": "indexname", -}, -Urls: []string{"http://localhost:9200"}, -}, -Dcp: dcpConfig.Dcp{ -Username: "user", -Password: "password", -BucketName: "dcp-test", -Hosts: []string{"localhost:8091"}, -Dcp: dcpConfig.ExternalDcp{ -Group: dcpConfig.DCPGroup{ -Name: "groupName", -Membership: dcpConfig.DCPGroupMembership{ -Type: "static", -}, -}, -}, -Metadata: dcpConfig.Metadata{ -Config: map[string]string{ -"bucket": "checkpoint-bucket-name", -"scope": "_default", -"collection": "_default", -}, -Type: "couchbase", -}, -}, -}). -SetMapper(mapper). -Build() -if err != nil { -panic(err) -} - -defer connector.Close() -connector.Start() + connector, err := dcpelasticsearch.NewConnectorBuilder(config.Config{ + Elasticsearch: config.Elasticsearch{ + CollectionIndexMapping: map[string]string{ + "_default": "indexname", + }, + Urls: []string{"http://localhost:9200"}, + }, + Dcp: dcpConfig.Dcp{ + Username: "user", + Password: "password", + BucketName: "dcp-test", + Hosts: []string{"localhost:8091"}, + Dcp: dcpConfig.ExternalDcp{ + Group: dcpConfig.DCPGroup{ + Name: "groupName", + Membership: dcpConfig.DCPGroupMembership{ + Type: "static", + }, + }, + }, + Metadata: dcpConfig.Metadata{ + Config: map[string]string{ + "bucket": "checkpoint-bucket-name", + "scope": "_default", + "collection": "_default", + }, + Type: "couchbase", + }, + }, + }). + SetMapper(mapper). + Build() + if err != nil { + panic(err) + } + + defer connector.Close() + connector.Start() } ``` @@ -114,8 +114,8 @@ Check out on [go-dcp](https://github.com/Trendyol/go-dcp#configuration) | `elasticsearch.concurrentRequest` | int | no | 1 | Concurrent bulk request count | | `elasticsearch.disableDiscoverNodesOnStart` | boolean | no | false | Disable discover nodes when initializing the client. | | `elasticsearch.discoverNodesInterval` | time.Duration | no | 5m | Discover nodes periodically | -| `elasticsearch.rejectionLog.Index` | string | no | cbes-rejects | Rejection log index name. `cbes-rejects` is default. | -| `elasticsearch.rejectionLog.IncludeSource` | boolean | no | false | Includes rejection log source info. `false` is default. | +| `elasticsearch.rejectionLog.index` | string | no | cbes-rejects | Rejection log index name. `cbes-rejects` is default. | +| `elasticsearch.rejectionLog.includeSource` | boolean | no | false | Includes rejection log source info. `false` is default. | ## Exposed metrics diff --git a/example/simple-rejection-log-sink-response-handler/main.go b/example/simple-rejection-log-sink-response-handler/main.go index 5c99998..7abeb61 100644 --- a/example/simple-rejection-log-sink-response-handler/main.go +++ b/example/simple-rejection-log-sink-response-handler/main.go @@ -19,7 +19,7 @@ func mapper(event couchbase.Event) []document.ESActionDocument { func main() { connector, err := dcpelasticsearch.NewConnectorBuilder("config.yml"). SetMapper(mapper). - SetSinkResponseHandler(&elasticsearch.RejectionLogSinkResponseHandler{}). + SetSinkResponseHandler(elasticsearch.NewRejectionLogSinkResponseHandler()). Build() if err != nil { panic(err)