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

one by one processing #59

Closed
IDIDIR opened this issue Jan 10, 2019 · 3 comments
Closed

one by one processing #59

IDIDIR opened this issue Jan 10, 2019 · 3 comments

Comments

@IDIDIR
Copy link

IDIDIR commented Jan 10, 2019

When I work with queues, my subscriber receives records one by one, but the next element comes to me without waiting for the operation to complete with the previous one. I tried to add the ack in the expectation that the processing will become consistent, but this did not happen. in my code, everything is built on async/await, so I have to somehow configure the framework. what am I doing wrong?

@IDIDIR IDIDIR changed the title one by one processing documentation one by one processing Jan 10, 2019
@sare84
Copy link

sare84 commented Jan 10, 2019

Hello,
I've had a similar problem and my solution was to add some more header information during the subscription process. My environment is an activemq server so the parameter here was 'activemq.prefetchSize': 1.

The full call was:

stompClient.subscribe('queuename', callback, {'ack': 'client', 'activemq.prefetchSize': 1 });

After adding this, the service got one message after another and not all at the same time.

Maybe this could help.

@kum-deepak
Copy link
Member

Prefetch limit combined with manual ack will ensure messages one by one. RabbitMQ also supports prefetch count: https://www.rabbitmq.com/stomp.html#pear.p.

Having said that, most of the brokers do not guarantee messages arriving in order (almost always it will be in order, but no guarantees). Many times it is possible to structure the logic to handle messages in parallel and delivered out of sequence.

@IDIDIR
Copy link
Author

IDIDIR commented Jan 11, 2019

It's work for my ActiveMQ
thx

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

3 participants