You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/11/26 14:14:52 UTC
[GitHub] cbornet opened a new pull request #3058: Add pull-mode on Websockets
cbornet opened a new pull request #3058: Add pull-mode on Websockets
URL: https://github.com/apache/pulsar/pull/3058
Fix #3052
### Motivation
Pull-mode gives more control on WebSocket for back-pressure than basing on consumer acks.
### Modifications
Added a query param `pullMode` that if set to true will listen to `permit` type consumer commands that indicate a `permitMessages` number of messages to be sent by the proxy.
The change is backward compatible with the current API:
* `pullMode` is false by default
* if no `type` is sent in the `ConsumerCommand`, it assumes the message is a consumer ack.
### Result
```
wscat -c "http://localhost:8080/ws/v2/consumer/persistent/public/default/my-topic/my-subscription?receiverQueueSize=0&pullMode=true"
connected (press CTRL+C to quit)
> {"type": "permit", "permitMessages": 1}
< {"messageId":"CMgTEAA=","payload":"SGVsbG8tMA==","properties":{},"publishTime":"2018-11-26T14:22:59.817+01:00"}
> {"type": "permit", "permitMessages": 2}
< {"messageId":"CMgTEAE=","payload":"SGVsbG8tMQ==","properties":{},"publishTime":"2018-11-26T14:22:59.84+01:00"}
< {"messageId":"CMgTEAI=","payload":"SGVsbG8tMg==","properties":{},"publishTime":"2018-11-26T14:22:59.844+01:00"}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services