Skip to content
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

Add ApiVersions #80

Closed
wants to merge 3 commits into from
Closed

Add ApiVersions #80

wants to merge 3 commits into from

Conversation

Pryz
Copy link
Contributor

@Pryz Pryz commented Feb 28, 2018

This PR adds the ApiVersions function to the API.

apiversions.go Outdated
return
}

type ApiVersionsV1 struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a protocol type, it shouldn't be exported.

conn.go Outdated
@@ -989,6 +989,31 @@ func (c *Conn) requestHeader(apiKey apiKey, apiVersion apiVersion, correlationID
}
}

// ApiVersions return the list of API versions supported by the broker.
func (c *Conn) ApiVersions() (versions []ApiVersionsV1, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we would need to call this from a program? If not we shouldn't export it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that it depends if the strategy is to let the user defining which protocol version to use or if we do that automatically in the library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it automatically, kafka-go aims to be simple to use, this kind of implementation complexity is worth abstracting.

conn.go Outdated
return []ApiVersionsV1{}, err
}

return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're mixing names and unnamed return values, this is a bit confusing to the reader.

@@ -5,7 +5,7 @@ kafka:
ports:
- "9092:9092"
environment:
KAFKA_VERSION: "0.10.1.0"
KAFKA_VERSION: "0.11.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double-checked and it looks like this environment variable isn't used anymore, we should use an explicit tag on the image instead.

Copy link
Contributor Author

@Pryz Pryz Feb 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still in used : https://github.com/wurstmeister/kafka-docker/blob/master/Dockerfile#L8.

I've also just tested it to run the tests against Kafka 1.0.0.

@Pryz Pryz force-pushed the add-apiversions branch 2 times, most recently from fd4bc4e to 7e5237f Compare June 1, 2018 19:35
@Pryz Pryz force-pushed the add-apiversions branch 7 times, most recently from 39ece72 to ed09f3c Compare July 13, 2018 21:39
@Pryz Pryz force-pushed the add-apiversions branch 5 times, most recently from 9ab0fcd to c4afafa Compare July 13, 2018 22:14
@Pryz
Copy link
Contributor Author

Pryz commented Sep 16, 2018

I'm going to close this PR. The first idea was just to introduce the ability to use the ApiVersion API and it then became the "dealing with all the Kafka API versions".

Instead of doing that, we are going to rethink the internals of the library and use the latest message formats.

@Pryz Pryz closed this Sep 16, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants