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

BulkConsumer doesn't produce errors #63

Open
jeancz opened this issue Oct 25, 2022 · 4 comments
Open

BulkConsumer doesn't produce errors #63

jeancz opened this issue Oct 25, 2022 · 4 comments

Comments

@jeancz
Copy link

jeancz commented Oct 25, 2022

I have suspicious about BulkConsumer which silently skips throwable errors. I quickly looked into the code and there is the try-catch block in the BulkConsumer.php which probably cause this.

I would prefer to remove this block and let control returning values by man.

@bckp
Copy link
Contributor

bckp commented Mar 13, 2023

Well, it will definitivly swallow the exception, but how you imagine this will work? If exception is thrown, and 2 messages did pass and third have exception and $ waiting, should we send 2 acks and then nacks with exceptions?

@TakeruDavis
Copy link

I reached similar problem, although first I tried to ask nicely and sent out IConsumer::MESSAGE_REJECT_AND_TERMINATE in the array or responses and when that didn't work, I tried resorting to throwing an exception.

In my case, database was temporarily too busy and EntityManager closed.
I wanted to reopen EntityManager, but it doesn't have a "reopen" method, seems it needs to be created again, but Nette DI would just give me the same instance of it and using the static create method wouldn't update DI

Considering messages that already passed, the code should never resort to throwing an exception, it should handle them and pass one of the status codes.
On the other hand, BulkConsumer should respect the _AND_TERMINATE part of the response, it should always terminate if at least one of the returned status codes requests it.

@bckp
Copy link
Contributor

bckp commented Nov 7, 2024

Well, problem with _AND_TERMINATE is, it is handled after all messages are completed... Right now,i belive the proper behavior is, you throw exceptions when BulkConsumer try to process data, on every message that have error, bulkConsumer should send NACK, and if one of messages is _AND_TERMINATE, it should kill itself after sending response.

EntityManager can be reopen, and you can even tell Container to flush instance and create new one, you can do so via removeService() method of container.

Right now, I do not contribute to this package anymore, made myself a fork (bckp/rabbitmq) and implemented some ideas I have in mind, now im in process of complete rewriting code, to bring plugins into play, so you can create BulkConsumer, DlxConsumer etc by yourself :) but there is NO ETA, simply when it will be ready, it will be ready :D

@bckp
Copy link
Contributor

bckp commented Nov 7, 2024

But quick look into code, you are indeed right, BulkConsumer does ignore AND_TERMINATE completly... I will think about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants