Kafka-node: AssertionError when using a different protocol

Created on 9 Jun 2017  路  3Comments  路  Source: SOHU-Co/kafka-node

Bug Report

I am getting the error AssertionError: Node path must not contain empty node name. I am using docker-compose so I am trying to connect do different containers (Kafka and zookeeper are running in two different containers).

Environment

  • Node version: 6.10.3
  • Kafka-node version: 1.6.2
  • Kafka version: 0.10.2.1

Include Sample Code to reproduce behavior

var client = new kafka.Client('zookeeper://zookeeper:2181')

This is the full error output

assert.js:81
  throw new assert.AssertionError({
  ^
AssertionError: Node path must not contain empty node name.
    at Object.validate (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/node-zookeeper-client/lib/Path.js:36:5)
    at new ConnectionStringParser (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/node-zookeeper-client/lib/ConnectionStringParser.js:46:14)
    at new ConnectionManager (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/node-zookeeper-client/lib/ConnectionManager.js:50:35)
    at new Client (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/node-zookeeper-client/index.js:200:30)
    at Object.createClient (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/node-zookeeper-client/index.js:907:12)
    at new Zookeeper (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/kafka-node/lib/zookeeper.js:18:27)
    at Client.connect (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/kafka-node/lib/client.js:81:22)
    at new Client (/Users/jinon/Documents/JavaScript/Demo Project GET/node_modules/kafka-node/lib/client.js:75:8)
    at Object.<anonymous> (/Users/jinon/Documents/JavaScript/Demo Project GET/models/messages.js:6:14)
    at Module._compile (module.js:570:32)

Most helpful comment

I believe the host name should be in the format <host>:<port> example: localhost:2181

All 3 comments

I believe the host name should be in the format <host>:<port> example: localhost:2181

According to the docker-compose docs, it seems like I have to write the host url like that in order for the containers to know who to talk to. I looked at more docs and saw that there is something called ConsumerGroups that support custom protocols

Custom Partition Assignment Protocol

You can pass a custom assignment strategy to the protocol array with the interface:
string :: name
integer :: version
object :: userData
protocol: ['roundrobin']

There isn't an example on how to do that though. Can you show me example code?

All you have to do is omit the protocol.. zookeeper://zookeeper:2181 -> my-zookeeper-container-host:2181, also make sure to link the containers in your docker-compose.yml

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twawszczak picture twawszczak  路  6Comments

comrat picture comrat  路  5Comments

aamitsharma2705 picture aamitsharma2705  路  4Comments

ashishnetworks picture ashishnetworks  路  4Comments

ghinks picture ghinks  路  6Comments