Search code examples
pythondocker-composeapache-pulsarpython-pulsar

Pulsar: Error Checking/Getting Partition Metadata while Subscribing on persistent://public/default/test


I currently have a docker-compose.yml file which brings up a number of services. One of these services is pulsar, and another is a webserver which is connected to via websocket. When I bring up these services, the websocket container doesn't work. It's logs say: Error Checking/Getting Partition Metadata while Subscribing on persistent://public/default/test. I'm not using partitions, so I'm having a lot of difficulty figure this out.

I've done a lot of Googling around so far, and found this question which has no answers, but looks similar to my problem.

This is my docker-compose.yml file:

version: '3.2'

services:
  pulsar:
    image: apachepulsar/pulsar:latest
    command: bin/pulsar standalone
    ports:
      - "6650"
      - "8080"

  ios_pos_ws_input:
    depends_on:
      - pulsar
    environment:
      - PULSAR_HOST=pulsar
    image: dock.gastrofix.com/bridge/ios_pos_ws_input:${VERSION:-latest}
    restart: always
    ports:
      - "8765"
    command: python3 -m wait_for_pulsar "python3 -m inputs.ios_pos.web_sockets.ws_server"

  ios_pos_ws_sink:
    depends_on:
      - pulsar
    environment:
      - PULSAR_HOST=pulsar
    image: dock.gastrofix.com/bridge/ios_pos_ws_sink:${VERSION:-latest}
    restart: always
    ports:
      - "8765"
    command: python3 -m wait_for_pulsar "python3 -m sinks.ios_pos_ws"

volumes:
  pulsar:

and when I check the logs of both ios_pos_ws_input and ios_pos_ws_sink I see this:

2019-05-15 14:12:52.809 INFO  ClientConnection:300 | [172.28.0.5:53624 -> 172.28.0.2:6650] Connected to broker
2019-05-15 14:12:52.920 ERROR ClientConnection:726 | [172.28.0.5:53624 -> 172.28.0.2:6650] Failed partition-metadata lookup req_id: 1 error: 1
2019-05-15 14:12:52.920 ERROR ClientImpl:394 | Error Checking/Getting Partition Metadata while Subscribing on persistent://public/default/test -- 5
2019-05-15 14:12:52.921 INFO  ClientImpl:492 | Closing Pulsar client
2019-05-15 14:12:54.922 INFO  Client:88 | Subscribing on Topic :test
2019-05-15 14:12:54.923 INFO  ConnectionPool:72 | Created connection for pulsar://pulsar:6650

I'd really like to figure this out. I appreciate any help in advance!


Solution

  • It looks like the public/default namespace is not yet created when the client tries to use it.

    I've tried with this simple compose file to put a bigger delay to ensure the standalone service is fully ready when the client starts:

    version: '3.2'
    
    services:
      pulsar:
        image: apachepulsar/pulsar:latest
        command: bin/pulsar standalone
        ports:
          - "6650"
          - "8080"
    
      client:
        depends_on:
          - pulsar
        image: apachepulsar/pulsar:latest
        command: python -c "import pulsar, time; time.sleep(30); c = pulsar.Client('pulsar://pulsar:6650'); p = c.create_producer('my-topic')"