Below is my configuration for running pulsar as a standalone version in docker-compose:
pulsar:
image: apachepulsar/pulsar:2.6.0
ports:
- 8080:8080
- 6650:6650
environment:
PULSAR_MEM: " -Xms512m -Xmx512m -XX:MaxDirectMemorySize=1g"
PULSAR_PREFIX_webSocketSessionIdleTimeoutMillis: 36000000
command: bash -c "bin/apply-config-from-env.py conf/standalone.conf && bin/pulsar standalone"
I am connecting pulsar from browser-client side as consumer. I am using JS websocket for connection.
Code for Client side :
new WebSocket(`ws://broker-service-url:8080/ws/v2/consumer/persistent/public/default/my-topic`)
And socket connection is successful.
Docker container is being created and after inspecting
/pulsar/conf/standalone.conf
in docker container, i can see updated value in standalone.conf file also.
As per findings on internet, I found that we can override configuration by adding prefix PULSAR_PREFIX_ and running command bash -c "bin/apply-config-from-env.py conf/standalone.conf && bin/pulsar standalone".I want to increase timeout for websocket idle connection.By default it is 30 seconds and I want to increase it.
Still websocket connection is disconnected from client side after 30 seconds which is default.
2
Answers
I have tried with your docker compose file. I see the config file is updated
And it also can be found in the log
Looks like it’s not the issue of the update config file script.
But maybe an issue with the WebSocket implementation.
Have you tried a new version such as 2.9.3 or 2.10.1? I’m not sure
if the issue has been fixed or not. If you can also see the issue
on a new version. It’s better to raise up a Github issue here.
It looks not a problem with the server side. I try to test if on my laptop, here is the log from the standalone
The session closed as expected (5min by default) not 30s
But I’m not using the JS WebSocket Client.
It looks like should be an issue with the JS WebSocket Client.
BTW, the URL you provided
ws://broker-service-url:8080/ws/v2/consumer/persistent/public/default/my-topic
is not correct which missed the subscription name.After change to
ws://url:8080/ws/v2/consumer/persistent/public/default/my-topic/my-sub
, I’m able to connect to the standalone.