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

Enable "tracing" of callbacks, without any requirements to callback itself, or rewriting commands etc. #45

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

kratkyzobak
Copy link

@kratkyzobak kratkyzobak commented Jul 7, 2016

Pull request to enable "tracing" of callbacks, without any requirements to callback itself, or rewriting commands etc.

Interface Kdyby\RabbitMq\IConsumerStartListener introduced
Every registered service implementign this interface will be registered to Consumer::onStart event. Service then can lregister any other event. Another approach needs to use Kdyby\Events (in some projects for this only purpose), or there would be requirements to "callback" classes.

onConsume append queueName and callback
Mostly for MultipleConsumer, there were introduced 3rd and 4th argument to onConsume event. 3rd = queueName (string), 4th = callback (callable).

Both of this allow you to "monitor" callback efficiency "externaly" without need to rewrite commands, or without need to make common parents for callback classes etc.

Commit 9841164
Fixed issue #40

Commit bbd98ba
As for memory, allowed to set time limit for consumer. It's usable for dirty apps, for example with MultipleConsumer, where can increase number of opened resources, which should be freed sometimes. When application doesn't do freeing in code, its good to be able "restart" it in predefined intervals to do this wrong way. (Restart = self-suicide and restart by supervisord. When parameter- t were introduced, you can now do this whole in supervisor config)

kratkyzobak and others added 17 commits July 3, 2016 16:57
Producers currently had method "setRoutingKey" (from AMQPMember), but this was not used at all. This commit allows to use this parameter as default routing key, instead of need to send it always to publish method.

Also routingKey parameter for producer introduced in config section.

In most use cases, there is application forced to publish with "magic constant" routingKey, which has to be same as routingKeys defined in consumers (for Multiple Consumers).

By allowing to set default routingKey is easy to move from simple Consumer (one per queue) to MultipleConsumer.

Also this commit brings more abstraction, since routingKey in simple cases could remain only in config.neon and there is no need for routingKey in app code.
@kratkyzobak
Copy link
Author

Hi, is it possible to review this pull request?

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

Successfully merging this pull request may close these issues.

1 participant