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

limit amount of messages received by a consumer #892

Open
aaleksandrov opened this issue Jan 14, 2020 · 1 comment
Open

limit amount of messages received by a consumer #892

aaleksandrov opened this issue Jan 14, 2020 · 1 comment

Comments

@aaleksandrov
Copy link

@aaleksandrov aaleksandrov commented Jan 14, 2020

Hi!
We're using this library with https://github.com/cometd/cometd-nodejs-client for fetching server-to-server from Salesforce. And when Salesforce publishes many messages (5k+) our consumer can't process it, runs out of memory etc.
Is it possible to limit amount of messages received by consumer? I cannot find anything regarding limits in cometd

@sbordet

This comment has been minimized.

Copy link
Member

@sbordet sbordet commented Jan 14, 2020

CometD is notifying message listeners synchronously: it reads from the network, it calls the listeners and does not read from the network again until the listeners return.

This naturally applies backpressure so that the client does not explode.

If the server sends down a single enormous message, or a single array of messages of an enormous length, then it's the server assuming too much of what the client can do, and I would see that as a server-side application mistake (it should split the enormous message, or split the array into smaller arrays).

I'm not that familiar with SalesForce message stream, but you should look into whether SalesForce allows you to configure how messages are sent from the server. For example, you may subscribe to less channels, or ask to be notified less frequently, etc.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.