Skip to content

Commit

Permalink
feat: Update README.md and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmtszr committed May 28, 2024
1 parent 916ea1c commit 1805a53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ under [the specified folder](examples/with-sasl-plaintext) and then start the ap
| `retryConfiguration.sasl.password` | SCRAM OR PLAIN password | |
| `retryConfiguration.skipMessageByHeaderFn` | Function to filter messages based on headers, return true if you want to skip the message | nil |
| `batchConfiguration.messageGroupLimit` | Maximum number of messages in a batch | |
| `batchConfiguration.messageGroupByteSizeLimit` | Maximum number of bytes in a batch | |
| `batchConfiguration.batchConsumeFn` | Kafka batch consumer function, if retry enabled it, is also used to consume retriable messages | |
| `batchConfiguration.preBatchFn` | This function enable for transforming messages before batch consuming starts | |
| `batchConfiguration.balancer` | [see doc](https://pkg.go.dev/github.com/segmentio/kafka-go#Balancer) | leastBytes |
Expand Down
19 changes: 19 additions & 0 deletions message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ func TestMessage_AddHeader(t *testing.T) {
})
}

func TestMessage_Size(t *testing.T) {
// Given
m := Message{
Headers: []kafka.Header{
{Key: "foo", Value: []byte("fooValue")},
},
Value: []byte("barValue"),
Key: []byte("bar"),
}

// When
s := m.TotalSize()

// Then
if s != 46 {
t.Fatalf("Total message size must be equal to 46")
}
}

func TestMessage_RemoveHeader(t *testing.T) {
// Given
m := Message{
Expand Down

0 comments on commit 1805a53

Please sign in to comment.