Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public static ChannelBuilder createChannelBuilder(AbstractConfig config, Time ti

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: you'll need to follow the pr format for kafka repos, similar to #329

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, modified the format. Lemme know if further adjustment is needed.

static List<InetAddress> resolve(String host, ClientDnsLookup clientDnsLookup) throws UnknownHostException {
InetAddress[] addresses = InetAddress.getAllByName(host);
log.debug("Resolved {} and got addresses: ", host);
for (InetAddress address: addresses) {
log.debug(address.getHostAddress() + ";");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this getHostAddress prints the actual resolved host name, not the bootstrap dns disco address, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

getHostAddress returns the IP address string in textual presentation.

}
if (ClientDnsLookup.USE_ALL_DNS_IPS == clientDnsLookup) {
return filterPreferredAddresses(addresses);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ public Node leastLoadedNode(long now) {
int nodeId = -1;
for (InetSocketAddress address : addresses) {
newNodes.add(new Node(nodeId--, address.getHostString(), address.getPort()));
log.debug("created Node with IP address: {}", address.getAddress().getHostAddress());
}

int offset = this.randOffset.nextInt(newNodes.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,20 @@ public KafkaProducer(Properties properties, Serializer<K> keySerializer, Seriali
valueSerializer));
try {
Map<String, Object> userProvidedConfigs = config.originals();
this.producerConfig = config;
this.time = time;

String transactionalId = userProvidedConfigs.containsKey(ProducerConfig.TRANSACTIONAL_ID_CONFIG) ?
(String) userProvidedConfigs.get(ProducerConfig.TRANSACTIONAL_ID_CONFIG) : null;

this.clientId = buildClientId(config.getString(ProducerConfig.CLIENT_ID_CONFIG), transactionalId);
String configuredClientId = config.getString(ProducerConfig.CLIENT_ID_CONFIG);

this.clientId = buildClientId(configuredClientId, transactionalId);

if (configuredClientId.isEmpty()) {
config.originals().put(ProducerConfig.CLIENT_ID_CONFIG, this.clientId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what's the usage for this? If user didn't supply a client.id, the printed configs will have client.id as empty field?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, when users didn't config client.id, kafka clients will self generate it and the ProducerConfig values result will be: client.id =

}

this.producerConfig = config;

LogContext logContext;
if (transactionalId == null)
Expand Down