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 describe config to kafkaclient #1142

Closed
wants to merge 1 commit into from

Conversation

jlandersen
Copy link
Contributor

@jlandersen jlandersen commented Dec 12, 2018

This allows fetching configs for topics and brokers, using the describe configs API (https://kafka.apache.org/protocol#The_Messages_DescribeConfigs).

Exposed as 3 methods on KafkaClient - describeConfigs which is a low level access to the API, and getTopicConfigs and getClusterConfigs on top. The request is supported on 0.11+.

As part of this there are a couple of new ways to send requests to brokers that are not with payloads.

Example use:

var kafka = require('..');
var client = new kafka.KafkaClient({
  kafkaHost: '127.0.0.1:9092'
});

client.on('ready', () => {
  // Get a broker ID and pass null for config names to get all
  const brokerId = Object.keys(client.brokerMetadata)[0];
  client.getClusterConfigs(brokerId, null, (err, result) => {
    console.log(result[brokerId]);
  });

  client.getTopicConfigs(['ExampleTopic', 'RebalanceTopic'], ['compression.type', 'message.format.version'], (err, result) => {
    console.log(result['ExampleTopic']);
    console.log(result['RebalanceTopic']);
  });
});

This allows fetching configs for topics and brokers via getTopicConfigs and getClusterConfigs.
The request is supported on 0.11+.

As part of this there are a couple of new ways to send requests to brokers that are not with payloads.
@jlandersen
Copy link
Contributor Author

Seems like Travis is failing on all runs due to

(+) Error: Client request error: getaddrinfo ENOTFOUND api.nodesecurity.io api.nodesecurity.io:443
npm ERR! Test failed.  See above for more details.
The command "npm test" exited with 1.

Any ideas? 🤔

@jlandersen
Copy link
Contributor Author

How do you know :-)

Closing in favour of #1081

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.

1 participant