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

Writers nats msgHandler needs refactor #1068

Open
mteodor opened this issue Mar 10, 2020 · 3 comments
Open

Writers nats msgHandler needs refactor #1068

mteodor opened this issue Mar 10, 2020 · 3 comments

Comments

@mteodor
Copy link
Contributor

mteodor commented Mar 10, 2020

Currently Writer's NATS msgHandler() is consuming NATS messages synchronosly with delivering message.
It should be changed so that it follows pattern of passing things into a queue and then having a number of workers
It can be automated with by using nc.ChanSubscribe or the SubscribeSync/NextMsg pattern

@drasko
Copy link
Contributor

drasko commented Apr 20, 2020

@mteodor can you please give links to nc.ChanSubscribe and SubscribeSync/NextMsg and explain better the concept and what do you want to achieve here.

We are not using Go channels here, and I am not sure that this is relevant or necessary for our use-case

@mteodor
Copy link
Contributor Author

mteodor commented Apr 22, 2020

If you have a large number of large messages and writing takes a long time you may lose messages.
With ChanSubscribe you will create a buffer for messages and process messages at pace.

https://github.com/mainflux/export/blob/ae3af57b13d7ce917f79a5e23a86974d4d9ac901/pkg/export/service.go#L184

@drasko
Copy link
Contributor

drasko commented Apr 22, 2020

These functions are using Go buffered channels, right?

This might be possible, because our Writers are all written in Go.

However, I would like here that we consider using NATS 2.0 and researchtheir QoS, i.e. queue and streaning that NATS 2.0 brings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants