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).
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)
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
Most helpful comment
I believe the host name should be in the format
<host>:<port>example:localhost:2181