Comments (6)
Hi
According to your configuration, processors will be called in this order:
- signal_handler
- exception_catcher
- ack
- max_messages
- your processor
- max_messages
- ack
- exception_catcher
- signal _handler
In your case, you received message number 19. Your processor did the job, the max messages processor have been called but your still under the limit you defined. Then the ack processor did it's job.
Then, you received message number 20. Your processor did the job. The max processor have been called and as you've reached you limit it did it's job (log + prevent other message). Then ack processor have been called and ack'ed the message.
I would recommend you to use this order:
- signal_handler
- max_messages
- exception_catcher
- ack
This way:
- Logs will be more understandable (first ack then max_messages & stop)
- You won't have trouble with exceptions (with your actual configuration, if the message number 20 have an exception, the max messages processor won't catch the exception, which means you will process another message)
from swarrotbundle.
hi @odolbeau,
first thank for you explanations and your time.
Just a point I am not sure to understand properly on the stack processor.
According to your configuration, processors will be called in this order:
signal_handler
exception_catcher
ack
max_messages
your processor
max_messages
ack
exception_catcher
signal _handler
This means that for every message consumption, we ack 2 times (before and after our internal processor) ? we catch any ex before and after our internal processor?
I though it is just a "one pass" processor stack
I am a little bit confused right now
from swarrotbundle.
When using a stack, your processor is decorated by others processors.
If you use only the ack processor:
- your processor is injected in the ack processor constructor
- the ack processor is called
- it calls you processor. If there is an error, the message is nacked, otherwise, it's acked.
Take a look a the implementation: https://github.com/swarrot/swarrot/blob/master/src/Swarrot/Processor/Ack/AckProcessor.php#L47-L63
This way, all processors can do some job before and / or after calling the next processor.
Not sure my explanations are really clear. :/ Does it makes sense?
from swarrotbundle.
@odolbeau thank you again for your time
what i mean is, seeing your comment (cf my previous post)
i understood that the processors stack defined is call before and after our processor
that is why i asked for "clarification" after your comment, because seeing the code and the picture on the readme of the lib (https://camo.githubusercontent.com/8ac89cd415aebfb1026b2278093dbcc986b126da/68747470733a2f2f646f63732e676f6f676c652e636f6d2f64726177696e67732f642f3145615f514a486f2d3970375957386c5f62793753344e494430652d41477058527a7a6974416c59593543632f7075623f773d39363026683d373230) seems weird
Thanks
from swarrotbundle.
This means that for every message consumption, we ack 2 times (before and after our internal processor) ? we catch any ex before and after our internal processor?
no, we don't ack twice. We run the AckProcessor logic in a specific place of the stack. But the AckProcessor is not acking the message both before and after calling the inner processing (actually, the AckProcessor does nothing before calling the inner processing, but it is still reached in the stack)
from swarrotbundle.
@stof ok understood
Thank you both
from swarrotbundle.
Related Issues (20)
- Flex recipes ? HOT 2
- Problem when type hinting method process in PHP7 HOT 5
- dot in messages-types are lost in the command help HOT 1
- Why the message type is not used as the queue name by default HOT 3
- Symfony 4.3 deprecations HOT 3
- Symfony Messenger and Swarrot compatibility HOT 1
- Reset application after each consummed message HOT 1
- Install Fail HOT 2
- Allow users to attach aliases to Swarrot commands HOT 2
- Upgrade to 1.8 on Symfony 3.4 HOT 7
- make queue declare before consume queue HOT 1
- Make Swarrot commands lazy HOT 2
- Consumer on multiple queues HOT 3
- Port cannot be configured by env var HOT 2
- Upgrade Doctrine dependencies HOT 4
- AMQPS configuration
- Multiple hosts support HOT 2
- Symfony 6 compatibility HOT 1
- CI needs to migrate away from Travis
- Non-existed services HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swarrotbundle.