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
Stream interface? #69
Comments
I'm not sure. Stream interface will add a huge layer of complexity to the code without real benefits. |
Maybe in a different library that wraps no-kafka. |
The stream interface is an essential building block for node apps and now too, kafka. We are writing our own stream wrapper for the consumer today but it's a little harder than it should be b/c the current consumer doesn't have any public pause/resume mechanism - we have to hack it by not resolving or rejecting the returned promise. |
Its not hard to add I mean I can add these two methods. |
@oleksiyk can you give an example, please? It seems to me the impl unpauses it https://github.com/oleksiyk/kafka/blob/master/lib/base_consumer.js#L71. Also, because subscribing is async it gets hard to pause it at the right time. |
An implementation unpauses it only once the handler has resolved. But the handler won't be called if the topic/partition is paused. I agree its hard to choose the right moment. So the easiest solution is to just not resolve the handler. |
@oleksiyk that causes the lib to read as fast as min(idleTimeout, handler execution speed) which causes a stream impl not to buffer which is not necessarily bad... Will be juggling the concept a little bit more. |
Hi All, Can you please suggest, If following is possible?
|
@black-star yes it is possible and the lib interfaces allow for it. See the base consumer implementation for details. |
Another benefit of Stream interface. Currently no-kafka producers never notify if Kafka/Zookeeper is unreachable. If producer was an See Mongoose for example: http://mongoosejs.com/docs/api.html#connection_Connection-readyState
|
Just a side note: no-kafka doesn't have a connection to Zookeeper. It was a part of pre 0.9 Kafka clients. |
Anyone interested to try #167 ? |
Looks cool I would be interested to try producer writable streams. |
@oleksiyk not sure totally related, but I have a requirement to pause all consumers (I use Is there a way to really pause the consumers? 10x! |
@hugebdu Have a look at https://github.com/oleksiyk/kafka/blob/master/lib/base_consumer.js#L40, as you can see paused topic/partitions are not fetched (omitted from Fetch request). So its really paused. |
@oleksiyk ok, thanks. Will double check my conclusions :) |
Producer / Consumers could benefit from a stream interface to increase interop with any NodeJS stream.
Thoughts?
The text was updated successfully, but these errors were encountered: