Skip to content

Use plain.Mechanism and get the Error: unexpected EOF #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
windyear opened this issue Aug 19, 2020 · 2 comments
Closed

Use plain.Mechanism and get the Error: unexpected EOF #490

windyear opened this issue Aug 19, 2020 · 2 comments

Comments

@windyear
Copy link

saslMech := plain.Mechanism{
	Username: username,
	Password: password,
}

dialer := &kafka.Dialer{
	// DualStack:     true,
	SASLMechanism: saslMech,
	ClientID: "zhang",
}

kafkaWriter := kafka.NewWriter(kafka.WriterConfig{
	Brokers: []string{brokers},
	Topic: topic,
	Balancer: &kafka.LeastBytes{},
	BatchTimeout: 100*time.Millisecond,
	BatchSize: 100,
	//Async: true,
	Dialer: dialer,
	})

err = kafkaWriter.WriteMessages(ctx, msg)

use the code to produce message to kafka,but get the unexpected EOF, Could someone give some advise to solve this problem? Or give the example to use sasl in kafka-go?

@windyear
Copy link
Author

Hi~ I use the v0.4.2 will get that error. But use the v0.3.7 is ok. I think this is becasue the 0.4.x is no stable. Thanks!

@YangAidi
Copy link

saslMech := plain.Mechanism{
	Username: username,
	Password: password,
}

dialer := &kafka.Dialer{
	// DualStack:     true,
	SASLMechanism: saslMech,
	ClientID: "zhang",
}

kafkaWriter := kafka.NewWriter(kafka.WriterConfig{
	Brokers: []string{brokers},
	Topic: topic,
	Balancer: &kafka.LeastBytes{},
	BatchTimeout: 100*time.Millisecond,
	BatchSize: 100,
	//Async: true,
	Dialer: dialer,
	})

err = kafkaWriter.WriteMessages(ctx, msg)

use the code to produce message to kafka,but get the unexpected EOF, Could someone give some advise to solve this problem? Or give the example to use sasl in kafka-go?

Thanks, your code tells me how use mechanism!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants