Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscribe examples #1

Closed
sshilko opened this issue Feb 5, 2018 · 3 comments
Closed

Subscribe examples #1

sshilko opened this issue Feb 5, 2018 · 3 comments

Comments

@sshilko
Copy link

sshilko commented Feb 5, 2018

Hello, project looks interesting, can you update simple subscribe examples and document it a bit.
Thx

@yerstd
Copy link
Collaborator

yerstd commented Feb 5, 2018

@sshilko Please check the subscribe and console example.

@sshilko
Copy link
Author

sshilko commented Feb 21, 2018

@stackerzzq thx, this library looks good and probably the ONLY one working with react/event-loop.

Meanwhile i had to write my own adapter for NSQ server (i had one for Beanstalkd) with compatible interface.

I really liked the code, few comments

  • should add package itself to packagist
  • identify needs finishing
  • no way to easily configure to receive ready > 1 at the moment
  • in case of error you touch message-id automatically just before REQ for some reason
  • to indicate failure one must throw exception inside user's callback, not too obvious
  • cls never called to cleanly close subscribed connection

What if user's callback takes more time than allowed by server, would be good to allow to do TOUCH initiated by user or to know how much time left. And overall nsq has launch options like --max-req-timeout=48h0m1s or --max-heartbeat-interval=2m0s - taking them into account would be nice (i.e. passing as server-configuration for client validation if someone tries to connect with hearbeat > server.max.hearbeat)

As far as i understood you have only one loop (react) running waiting to receive messages and then blocking callback to execute user handler is called upon receiving valid message. And plus some more timers/loops can be added alongside (addPeriodicTimer). So technicly not to have blocking handler, i can setup timer with ±MIN_INTERVAL that will actually process messages instead of user's callback and have small queue between two loops.

Anyway this code looks really good and extendable, you should apply to be listed on http://nsq.io/clients/client_libraries.html

I'm stuck in production for now with my own blocking implementation but if would used the event loop, the result will look really similar.

@yerstd
Copy link
Collaborator

yerstd commented Apr 3, 2018

@sshilko ok, nice comments. I will make it better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants