Skip to content

Commit

Permalink
chore: migrate module to github.com/IBM/sarama
Browse files Browse the repository at this point in the history
- update declared module path and imports to github.com/IBM/sarama
- update URLs to issues/pull requests to use
  https://github.com/IBM/sarama as well (as we don't know how long the
  GitHub transparent redirects last for)

Signed-off-by: Dominic Evans <[email protected]>
  • Loading branch information
dnwe committed Jul 17, 2023
1 parent fd35e17 commit c2cab9d
Show file tree
Hide file tree
Showing 38 changed files with 581 additions and 581 deletions.
1,018 changes: 509 additions & 509 deletions CHANGELOG.md

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# sarama

[![Go Reference](https://pkg.go.dev/badge/github.com/Shopify/sarama.svg)](https://pkg.go.dev/github.com/Shopify/sarama)
[![Coverage](https://codecov.io/gh/Shopify/sarama/branch/main/graph/badge.svg)](https://codecov.io/gh/Shopify/sarama)
[![Go Reference](https://pkg.go.dev/badge/github.com/IBM/sarama.svg)](https://pkg.go.dev/github.com/IBM/sarama)

Sarama is an MIT-licensed Go client library for [Apache Kafka](https://kafka.apache.org/).

## Getting started

- API documentation and examples are available via [pkg.go.dev](https://pkg.go.dev/github.com/Shopify/sarama).
- API documentation and examples are available via [pkg.go.dev](https://pkg.go.dev/github.com/IBM/sarama).
- Mocks for testing are available in the [mocks](./mocks) subpackage.
- The [examples](./examples) directory contains more elaborate example applications.
- The [tools](./tools) directory contains command line tools that can be useful for testing, diagnostics, and instrumentation.

You might also want to look at the [Frequently Asked Questions](https://github.com/Shopify/sarama/wiki/Frequently-Asked-Questions).
You might also want to look at the [Frequently Asked Questions](https://github.com/IBM/sarama/wiki/Frequently-Asked-Questions).

## Compatibility and API stability

Expand All @@ -21,13 +20,13 @@ the two latest stable releases of Kafka and Go, and we provide a two month
grace period for older releases. However, older releases of Kafka are still likely to work.

Sarama follows semantic versioning and provides API stability via the gopkg.in service.
You can import a version with a guaranteed stable API via http://gopkg.in/Shopify/sarama.v1.
You can import a version with a guaranteed stable API via http://gopkg.in/IBM/sarama.v1.
A changelog is available [here](CHANGELOG.md).

## Contributing

- Get started by checking our [contribution guidelines](https://github.com/Shopify/sarama/blob/main/.github/CONTRIBUTING.md).
- Read the [Sarama wiki](https://github.com/Shopify/sarama/wiki) for more technical and design details.
- Get started by checking our [contribution guidelines](https://github.com/IBM/sarama/blob/main/.github/CONTRIBUTING.md).
- Read the [Sarama wiki](https://github.com/IBM/sarama/wiki) for more technical and design details.
- The [Kafka Protocol Specification](https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol) contains a wealth of useful information.
- For more general issues, there is [a google group](https://groups.google.com/forum/#!forum/kafka-clients) for Kafka client developers.
- If you have any questions, just ask!
4 changes: 2 additions & 2 deletions async_producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ func TestAsyncProducerMultipleRetriesWithBackoffFunc(t *testing.T) {
}
}

// https://github.com/Shopify/sarama/issues/2129
// https://github.com/IBM/sarama/issues/2129
func TestAsyncProducerMultipleRetriesWithConcurrentRequests(t *testing.T) {
// Logger = log.New(os.Stdout, "[sarama] ", log.LstdFlags)
seedBroker := NewMockBroker(t, 1)
Expand Down Expand Up @@ -1302,7 +1302,7 @@ func TestAsyncProducerIdempotentRetryCheckBatch(t *testing.T) {
}
}

// test case for https://github.com/Shopify/sarama/pull/2378
// test case for https://github.com/IBM/sarama/pull/2378
func TestAsyncProducerIdempotentRetryCheckBatch_2378(t *testing.T) {
broker := NewMockBroker(t, 1)

Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ func (client *client) RefreshMetadata(topics ...string) error {

// Prior to 0.8.2, Kafka will throw exceptions on an empty topic and not return a proper
// error. This handles the case by returning an error instead of sending it
// off to Kafka. See: https://github.com/Shopify/sarama/pull/38#issuecomment-26362310
// off to Kafka. See: https://github.com/IBM/sarama/pull/38#issuecomment-26362310
for _, topic := range topics {
if topic == "" {
return ErrInvalidTopic // this is the error that 0.8.2 and later correctly return
Expand Down
2 changes: 1 addition & 1 deletion consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ func TestConsumeMessagesFromReadReplicaErrorUnknown(t *testing.T) {
// consumer connects back to the new leader to resume consumption and doesn't
// continue consuming from the follower.
//
// See https://github.com/Shopify/sarama/issues/1927
// See https://github.com/IBM/sarama/issues/1927
func TestConsumeMessagesTrackLeader(t *testing.T) {
cfg := NewConfig()
cfg.ClientID = t.Name()
Expand Down
10 changes: 4 additions & 6 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# Sarama examples

This folder contains example applications to demonstrate the use of Sarama. For code snippet examples on how to use the different types in Sarama, see [Sarama's API documentation on pkg.go.dev](https://pkg.go.dev/github.com/Shopify/sarama)

In these examples, we use `github.com/Shopify/sarama` as import path. We do this to ensure all the examples are up to date with the latest changes in Sarama. For your own applications, you may want to use `gopkg.in/Shopify/sarama.v1` to lock into a stable API version.
This folder contains example applications to demonstrate the use of Sarama. For code snippet examples on how to use the different types in Sarama, see [Sarama's API documentation on pkg.go.dev](https://pkg.go.dev/github.com/IBM/sarama)

#### HTTP server

[http_server](./http_server) is a simple HTTP server uses both the sync producer to produce data as part of the request handling cycle, as well as the async producer to maintain an access log. It also uses the [mocks subpackage](https://pkg.go.dev/github.com/Shopify/sarama/mocks) to test both.
[http_server](./http_server) is a simple HTTP server uses both the sync producer to produce data as part of the request handling cycle, as well as the async producer to maintain an access log. It also uses the [mocks subpackage](https://pkg.go.dev/github.com/IBM/sarama/mocks) to test both.

#### Interceptors

Basic example to use a producer interceptor that produces [OpenTelemetry](https://github.com/open-telemetry/opentelemetry-go/) spans and add some headers for each intercepted message.

#### Transactional Producer

[txn_producer](./txn_producer) Basic example to use a transactional producer that produce on some topic within a Kafka transaction. To ensure transactional-id uniqueness it implement some ***ProducerProvider*** that build a producer appending an integer that grow when producer is created.
[txn_producer](./txn_producer) Basic example to use a transactional producer that produce on some topic within a Kafka transaction. To ensure transactional-id uniqueness it implement some **_ProducerProvider_** that build a producer appending an integer that grow when producer is created.

#### Exacly-once transactional paradigm

[exactly_once](./exactly_once) Basic example to use a transactional producer that produce consumed message from some topics within a Kafka transaction. To ensure transactional-id uniqueness it implement some ***ProducerProvider*** that build a producer using current message topic-partition.
[exactly_once](./exactly_once) Basic example to use a transactional producer that produce consumed message from some topics within a Kafka transaction. To ensure transactional-id uniqueness it implement some **_ProducerProvider_** that build a producer using current message topic-partition.
6 changes: 3 additions & 3 deletions examples/consumergroup/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/Shopify/sarama/examples/consumer
module github.com/IBM/sarama/examples/consumer

go 1.16

require github.com/Shopify/sarama v1.34.1
require github.com/IBM/sarama v1.34.1

replace github.com/Shopify/sarama => ../../
replace github.com/IBM/sarama => ../../
6 changes: 3 additions & 3 deletions examples/consumergroup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sync"
"syscall"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

// Sarama configuration options
Expand Down Expand Up @@ -178,7 +178,7 @@ func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, clai
// NOTE:
// Do not move the code below to a goroutine.
// The `ConsumeClaim` itself is called within a goroutine, see:
// https://github.com/Shopify/sarama/blob/main/consumer_group.go#L27-L29
// https://github.com/IBM/sarama/blob/main/consumer_group.go#L27-L29
for {
select {
case message := <-claim.Messages():
Expand All @@ -187,7 +187,7 @@ func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, clai

// Should return when `session.Context()` is done.
// If not, will raise `ErrRebalanceInProgress` or `read tcp <ip>:<port>: i/o timeout` when kafka rebalance. see:
// https://github.com/Shopify/sarama/issues/1192
// https://github.com/IBM/sarama/issues/1192
case <-session.Context().Done():
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions examples/exactly_once/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/Shopify/sarama/examples/exactly_once
module github.com/IBM/sarama/examples/exactly_once

go 1.16

require github.com/Shopify/sarama v1.34.1
require github.com/IBM/sarama v1.34.1

replace github.com/Shopify/sarama => ../../
replace github.com/IBM/sarama => ../../
6 changes: 3 additions & 3 deletions examples/exactly_once/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"syscall"
"time"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

// Sarama configuration options
Expand Down Expand Up @@ -197,7 +197,7 @@ func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, clai
// NOTE:
// Do not move the code below to a goroutine.
// The `ConsumeClaim` itself is called within a goroutine, see:
// https://github.com/Shopify/sarama/blob/main/consumer_group.go#L27-L2
// https://github.com/IBM/sarama/blob/main/consumer_group.go#L27-L2
for {
select {
case message := <-claim.Messages():
Expand Down Expand Up @@ -243,7 +243,7 @@ func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, clai
}()
// Should return when `session.Context()` is done.
// If not, will raise `ErrRebalanceInProgress` or `read tcp <ip>:<port>: i/o timeout` when kafka rebalance. see:
// https://github.com/Shopify/sarama/issues/1192
// https://github.com/IBM/sarama/issues/1192
case <-session.Context().Done():
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion examples/http_server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"strings"
"time"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions examples/http_server/http_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/http/httptest"
"testing"

"github.com/Shopify/sarama"
"github.com/Shopify/sarama/mocks"
"github.com/IBM/sarama"
"github.com/IBM/sarama/mocks"
)

// In normal operation, we expect one access log entry,
Expand Down
6 changes: 3 additions & 3 deletions examples/interceptors/go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/Shopify/sarama/examples/interceptors
module github.com/IBM/sarama/examples/interceptors

go 1.16

replace github.com/Shopify/sarama => ../../
replace github.com/IBM/sarama => ../../

require (
github.com/Shopify/sarama v1.27.0
github.com/IBM/sarama v1.27.0
go.opentelemetry.io/otel v0.10.0
go.opentelemetry.io/otel/exporters/stdout v0.10.0
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940 // indirect
Expand Down
3 changes: 2 additions & 1 deletion examples/interceptors/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
"strings"
"time"

"github.com/Shopify/sarama"
"go.opentelemetry.io/otel/exporters/stdout"

"github.com/IBM/sarama"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion examples/interceptors/trace_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"strings"

"github.com/Shopify/sarama"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/kv"
"go.opentelemetry.io/otel/api/trace"

"github.com/IBM/sarama"
)

type OTelInterceptor struct {
Expand Down
2 changes: 1 addition & 1 deletion examples/sasl_scram_client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os/signal"
"strings"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions examples/txn_producer/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/Shopify/sarama/examples/txn_producer
module github.com/IBM/sarama/examples/txn_producer

go 1.16

require (
github.com/Shopify/sarama v1.34.1
github.com/IBM/sarama v1.34.1
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
)

replace github.com/Shopify/sarama => ../../
replace github.com/IBM/sarama => ../../
5 changes: 3 additions & 2 deletions examples/txn_producer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"syscall"
"time"

"github.com/Shopify/sarama"
_ "net/http/pprof"

"github.com/rcrowley/go-metrics"

_ "net/http/pprof"
"github.com/IBM/sarama"
)

// Sarama configuration options
Expand Down
2 changes: 1 addition & 1 deletion functional_producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ func testProducingMessages(t *testing.T, config *Config) {
// cleanly recover if network connectivity to the remote brokers is lost and
// then subsequently resumed.
//
// https://github.com/Shopify/sarama/issues/2129
// https://github.com/IBM/sarama/issues/2129
func TestAsyncProducerRemoteBrokerClosed(t *testing.T) {
setupFunctionalTest(t)
defer teardownFunctionalTest(t)
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Shopify/sarama
module github.com/IBM/sarama

go 1.17

Expand Down Expand Up @@ -39,8 +39,8 @@ require (
)

retract (
v1.32.0 // producer hangs on retry https://github.com/Shopify/sarama/issues/2150
[v1.31.0, v1.31.1] // producer deadlock https://github.com/Shopify/sarama/issues/2129
[v1.26.0, v1.26.1] // consumer fetch session allocation https://github.com/Shopify/sarama/pull/1644
[v1.24.1, v1.25.0] // consumer group metadata reqs https://github.com/Shopify/sarama/issues/1544
v1.32.0 // producer hangs on retry https://github.com/IBM/sarama/issues/2150
[v1.31.0, v1.31.1] // producer deadlock https://github.com/IBM/sarama/issues/2129
[v1.26.0, v1.26.1] // consumer fetch session allocation https://github.com/IBM/sarama/pull/1644
[v1.24.1, v1.25.0] // consumer group metadata reqs https://github.com/IBM/sarama/issues/1544
)
6 changes: 3 additions & 3 deletions mocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ You can use them to test your sarama applications using dependency injection.

The following mock objects are available:

- [Consumer](https://pkg.go.dev/github.com/Shopify/sarama/mocks#Consumer), which will create [PartitionConsumer](https://pkg.go.dev/github.com/Shopify/sarama/mocks#PartitionConsumer) mocks.
- [AsyncProducer](https://pkg.go.dev/github.com/Shopify/sarama/mocks#AsyncProducer)
- [SyncProducer](https://pkg.go.dev/github.com/Shopify/sarama/mocks#SyncProducer)
- [Consumer](https://pkg.go.dev/github.com/IBM/sarama/mocks#Consumer), which will create [PartitionConsumer](https://pkg.go.dev/github.com/IBM/sarama/mocks#PartitionConsumer) mocks.
- [AsyncProducer](https://pkg.go.dev/github.com/IBM/sarama/mocks#AsyncProducer)
- [SyncProducer](https://pkg.go.dev/github.com/IBM/sarama/mocks#SyncProducer)

The mocks allow you to set expectations on them. When you close the mocks, the expectations will be verified,
and the results will be reported to the `*testing.T` object you provided when creating the mock.
2 changes: 1 addition & 1 deletion mocks/async_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"sync"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

// AsyncProducer implements sarama's Producer interface for testing purposes.
Expand Down
2 changes: 1 addition & 1 deletion mocks/async_producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

func generateRegexpChecker(re string) func([]byte) error {
Expand Down
2 changes: 1 addition & 1 deletion mocks/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"sync/atomic"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

// Consumer implements sarama's Consumer interface for testing purposes.
Expand Down
2 changes: 1 addition & 1 deletion mocks/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"testing"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

func TestMockConsumerImplementsConsumerInterface(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion mocks/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"errors"
"fmt"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

// ErrorReporter is a simple interface that includes the testing.T methods we use to report
Expand Down
2 changes: 1 addition & 1 deletion mocks/sync_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"sync"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

// SyncProducer implements sarama's SyncProducer interface for testing purposes.
Expand Down
2 changes: 1 addition & 1 deletion mocks/sync_producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
)

func TestMockSyncProducerImplementsSyncProducerInterface(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion offset_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (om *offsetManager) handleResponse(broker *Broker, req *OffsetCommitRequest
// let the user know *and* try redispatching - if topic-auto-create is
// enabled, redispatching should trigger a metadata req and create the
// topic; if not then re-dispatching won't help, but we've let the user
// know and it shouldn't hurt either (see https://github.com/Shopify/sarama/issues/706)
// know and it shouldn't hurt either (see https://github.com/IBM/sarama/issues/706)
fallthrough
default:
// dunno, tell the user and try redispatching
Expand Down
2 changes: 1 addition & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Some of these tools mirror tools that ship with Kafka, but these tools won't req
- [kafka-console-consumer](./kafka-console-consumer): a command line tool to consume arbitrary partitions of a topic on your Kafka cluster.
- [kafka-producer-performance](./kafka-producer-performance): a command line tool to performance test producers (sync and async) on your Kafka cluster.

To install all tools, run `go get github.com/Shopify/sarama/tools/...`
To install all tools, run `go get github.com/IBM/sarama/tools/...`
Loading

0 comments on commit c2cab9d

Please sign in to comment.