Skip to content

Commit

Permalink
chore: README update
Browse files Browse the repository at this point in the history
  • Loading branch information
erayarslan committed Mar 24, 2023
1 parent 4455b04 commit a9e1a0e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,21 @@ Check out on [go-dcp-client](https://github.com/Trendyol/go-dcp-client#configura

### Kafka Specific Configuration

| Variable | Type | Is Required |
|-------------------------------------|----------------------|-------------|
| `kafka.collectionTopicMapping` | map[string]string | yes |
| `kafka.brokers` | array | yes |
| `kafka.readTimeout` | integer | no |
| `kafka.compression` | integer | no |
| `kafka.writeTimeout` | integer | no |
| `kafka.producerBatchSize` | integer | yes |
| `kafka.producerBatchTickerDuration` | integer | yes |
| `kafka.requiredAcks` | integer | no |
| `kafka.secureConnection` | boolean (true/false) | no |
| `kafka.rootCAPath` | string | no |
| `kafka.interCAPath` | string | no |
| `kafka.scramUsername` | string | no |
| `kafka.scramPassword` | string | no |
| Variable | Type | Required | Default |
|-------------------------------------|-------------------|----------|---------|
| `kafka.collectionTopicMapping` | map[string]string | yes | |
| `kafka.brokers` | []string | yes | |
| `kafka.producerBatchSize` | integer | yes | |
| `kafka.producerBatchTickerDuration` | time.Duration | yes | |
| `kafka.readTimeout` | time.Duration | no | |
| `kafka.compression` | integer | no | |
| `kafka.writeTimeout` | time.Duration | no | |
| `kafka.requiredAcks` | integer | no | |
| `kafka.secureConnection` | bool | no | |
| `kafka.rootCAPath` | string | no | |
| `kafka.interCAPath` | string | no | |
| `kafka.scramUsername` | string | no | |
| `kafka.scramPassword` | string | no | |

---

Expand Down
25 changes: 12 additions & 13 deletions kafka/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,18 @@ func (c *client) GetPartitions(topic string) ([]int, error) {

func (c *client) Producer() *kafka.Writer {
return &kafka.Writer{
Addr: kafka.TCP(c.config.Brokers...),
Balancer: &kafka.Hash{},
BatchSize: c.config.ProducerBatchSize,
BatchBytes: math.MaxInt,
BatchTimeout: 500 * time.Microsecond,
MaxAttempts: math.MaxInt,
ReadTimeout: c.config.ReadTimeout,
WriteTimeout: c.config.WriteTimeout,
RequiredAcks: kafka.RequiredAcks(c.config.RequiredAcks),
Logger: c.logger,
ErrorLogger: c.errorLogger,
Compression: kafka.Compression(c.config.GetCompression()),
AllowAutoTopicCreation: true,
Addr: kafka.TCP(c.config.Brokers...),
Balancer: &kafka.Hash{},
BatchSize: c.config.ProducerBatchSize,
BatchBytes: math.MaxInt,
BatchTimeout: 500 * time.Microsecond,
MaxAttempts: math.MaxInt,
ReadTimeout: c.config.ReadTimeout,
WriteTimeout: c.config.WriteTimeout,
RequiredAcks: kafka.RequiredAcks(c.config.RequiredAcks),
Logger: c.logger,
ErrorLogger: c.errorLogger,
Compression: kafka.Compression(c.config.GetCompression()),
}
}

Expand Down

0 comments on commit a9e1a0e

Please sign in to comment.